Re: Converting Strings to Ints.
- To: mathgroup at smc.vnet.net
- Subject: [mg63287] Re: Converting Strings to Ints.
- From: "Jean-Marc Gulliet" <jeanmarc.gulliet at gmail.com>
- Date: Fri, 23 Dec 2005 05:08:15 -0500 (EST)
- Organization: The Open University, Milton Keynes, U.K.
- References: <200512200919.EAA28501@smc.vnet.net> <200512210435.XAA14697@smc.vnet.net> <dode99$64c$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"Chrisantha" <ctf20 at sussex.ac.uk> a écrit dans le message de news: dode99$64c$1 at smc.vnet.net... | 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 | Hi Chrisantha, You can use the built-in function *ToExpression* (see In[4]): In[1]:= lst = {"12223", "11313", "2424"} Out[1]= {12223,11313,2424} In[2]:= FullForm[lst] Out[2]//FullForm= List["12223","11313","2424"] In[3]:= Head /@ lst Out[3]= {String,String,String} In[4]:= data = ToExpression[lst] Out[4]= {12223,11313,2424} In[5]:= FullForm[data] Out[5]//FullForm= List[12223,11313,2424] In[6]:= Head /@ data Out[6]= {Integer,Integer,Integer} Best regards, /J.M.
- 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?