Re: Converting Strings to Ints.
- To: mathgroup at smc.vnet.net
- Subject: [mg63289] Re: Converting Strings to Ints.
- From: "Dr. Wolfgang Hintze" <weh at snafu.de>
- Date: Fri, 23 Dec 2005 05:08:17 -0500 (EST)
- References: <200512200919.EAA28501@smc.vnet.net> <200512210435.XAA14697@smc.vnet.net> <dode99$64c$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Use the function ToExpression.
1) These are your data
In[1]:= in = {"12223", "11313", "2424"}
Out[1]= {"12223", "11313", "2424"}
Check that the input is not numbers
In[8]:= NumberQ /@ in
Out[8]= {False, False, False}
2) Now transform to numbers (the list as a whole)
In[9]:= in2number = ToExpression[in]
Out[9]= {12223, 11313, 2424}
... and check
In[7]:= NumberQ /@ in2number
Out[7]= {True, True, True}
Regards,
Wolfgang
Chrisantha wrote:
> Dear All,
>
> I have a list of strings representing numbers, i.e. a =
> {"12223","11313","2424"} that I generated in XML and read into
> mathematica. How do I convert this into a list of integers?
>
> Yours Ever and Merry Christmas,
>
> Chrisantha
>
>
- References:
- Expression timing; a black art?
- From: AES <siegman@stanford.edu>
- Re: Expression timing; a black art?
- From: "Carl K. Woll" <carlw@wolfram.com>
- Expression timing; a black art?