MathGroup Archive 2003

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

Search the Archive

Re: type casting

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39836] Re: [mg39800] type casting
  • From: Tomas Garza <tgarza01 at prodigy.net.mx>
  • Date: Sat, 8 Mar 2003 02:50:02 -0500 (EST)
  • References: <200303070840.DAA15614@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Presumably your string has numbers in string format. Use ToExpression to
convert numbers in string format to numbers.

In[1]:=
aString = {"2", "4", "5.5"};

In[2]:=
Head /@ aString
Out[2]=
{String, String, String}

In[3]:=
ToExpression[aString]
Out[3]=
{2, 4, 5.5}

In[4]:=
Head /@ %
Out[4]=
{Integer, Integer, Real}

Tomas Garza
Mexico City
----- Original Message -----
From: "Tolonen, Ellen N" <entolonen at utep.edu>
To: mathgroup at smc.vnet.net
Subject: [mg39836] [mg39800] type casting


> Hello.
>
> I am I new Mathematica user and am trying to master input/output.  Is
there
> any way to type cast a string into number format?
>
>
> Ellen Tolonen
> entolonen at utep.edu
>
>




  • References:
    • type casting
      • From: "Tolonen, Ellen N" <entolonen@utep.edu>
  • Prev by Date: Re: type casting
  • Next by Date: Symbols and Lists
  • Previous by thread: type casting
  • Next by thread: Re: type casting