Re: Got a tip ?
- To: mathgroup at smc.vnet.net
- Subject: [mg97859] Re: [mg97843] Got a tip ?
- From: Adriano Pascoletti <adriano.pascoletti at dimi.uniud.it>
- Date: Tue, 24 Mar 2009 05:29:53 -0500 (EST)
- References: <200903230905.EAA27168@smc.vnet.net>
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 >
- References:
- Got a tip ?
- From: Fabrizio <Tekcitizen@hotmail.com>
- Got a tip ?