MathGroup Archive 2008

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

Search the Archive

Re: Variable question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92509] Re: [mg92468] Variable question
  • From: "Adriano Pascoletti" <adriano.pascoletti at gmail.com>
  • Date: Thu, 2 Oct 2008 04:35:24 -0400 (EDT)
  • References: <200810012229.SAA09621@smc.vnet.net>

StringTake[var, {1}] returns a string consisting of the first character of
var, i.e. "c". You should use


ToExpression[StringTake[var, {1}]]


In[5]:= c = 3
var = "c"
v = ToExpression[StringTake[var, {1}]]
Out[5]= 3
Out[6]= "c"
Out[7]= 3


Adriano Pascoletti

2008/10/2 <Johney at giganews.com>

> I have the following test code
>
> c = 3
> var = "c"
> v = StringTake[var, {1}]
> v
>
>
> v is showing up as c but I want it to show up as 3.  Is there a way to do
> this?
>
> Thanks
>
>
>


  • Prev by Date: Re: Variable question
  • Next by Date: Re: command line options: -initfile vs -run
  • Previous by thread: Variable question
  • Next by thread: Re: Variable question