MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: String to list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60950] Re: String to list
  • From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 5 Oct 2005 02:27:51 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <dht4il$ho4$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,
Str = "Hi every one!";
Characters[Str]

gives

{H, i, , e, v, e, r, y, , o, n, e, !}

and

Characters[
Str] //. {{d___, Null ..., a__String, " ", b___} 
:> {d, Null,
StringJoin[a], Null, b},
{a___, Null, b__String} :> {a, Null, 
StringJoin[b]}} /.
Null :> Sequence[]

gives

{Hi, every, one!}

and

ImportString[Str, "List"]

and

ImportString[Str, "Words"]

gives also

{Hi, every, one!}

Regards

  Jens

"Sara" <ma_sara177 at hotmail.com> schrieb im 
Newsbeitrag news:dht4il$ho4$1 at smc.vnet.net...
| How can I transform a string to a list??
| example:
| Str="Hi every one!"  and the list af str=?????
| 



  • Prev by Date: Re: String to list
  • Next by Date: Problem with D and Abs
  • Previous by thread: Re: String to list
  • Next by thread: Re: String to list