MathGroup Archive 2007

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

Search the Archive

String to List

  • To: mathgroup at
  • Subject: [mg76959] String to List
  • From: "King, Peter R" <peter.king at>
  • Date: Wed, 30 May 2007 05:36:13 -0400 (EDT)

I have a string which in general looks something like


In other words it looks like a list with a mixture of characters and
numbers and so on. I want to pick out the individual elements of this
(using the commas as delimiters)

Clearly a[[1]] etc doesn't mean anything

I can do b=ToExpression[a] and I get a list so b[[1]] is x  and
b[[2]]=16 (that is the number sixteen but I can convert this back into =
string with ToString. The problem is b[[4]] which ToExpression turns
into T as it thinks I mean 1 x T.

So I would appreciate help with either

i) converting my original string to a list as I would like


Ii) stopping the evaluation of 1T into T so that I can get the string 1T

(The only thought I had was to step through the original string
character by character telling it to put the characters into different
elements of a list each time  I pass a comma, but this looked a bit

Many thanks,

Peter King

  • Prev by Date: Re: Stopping Automatic Animation in v6
  • Next by Date: TableForm vs. Grid (v.6)
  • Previous by thread: Re: Famous Mathematica 5.0 not working with Mathematica 6?
  • Next by thread: Re: String to List