Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Converting Strings to Ints.


On Dec 22, 2005, at 12:04 AM, 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

Here is a newbie approach:

In[1]:=
str = {"12223", "11313",
    "2424"}
Out[1]=
{"12223", "11313", "2424"}

In[2]:=
ToExpression[str]
Out[2]=
{12223, 11313, 2424}

In[3]:=
Head[%[[1]]]
Out[3]=
Integer

János


----------------------------------------------
Trying to argue with a politician is like lifting up the head of a  
corpse.
(S. Lem: His Master Voice)


  • Prev by Date: Re: Returning an empty sequence
  • Next by Date: Re: Converting Strings to Ints.
  • Previous by thread: Re: Converting Strings to Ints.
  • Next by thread: Re: Converting Strings to Ints.