MathGroup Archive 2009

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

Search the Archive

Re: Got a tip ?


Something like this?


f[c_String] := First[ToCharacterCode[c] - ToCharacterCode["a"] + 1] /;

     StringLength[c] === 1


gives


In[11]:= f["z"]
Out[11]= 26


Adriano Pascoletti


2009/3/23 Fabrizio <Tekcitizen at hotmail.com>

> Hello,
>
> I want to write a function that translates its argument (which is a letter
> of the alphabet) into a numerical value.
>
> f[a] = 1
> f[b] = 2
>


  • Prev by Date: Re: Got a tip ?
  • Next by Date: Re: NDSolve error "nlnum"
  • Previous by thread: Re: Got a tip ?
  • Next by thread: Re: Got a tip ?