Re: Got a tip ?
- To: mathgroup at smc.vnet.net
- Subject: [mg97867] Re: [mg97843] Got a tip ?
- From: Curtis Osterhoudt <cfo at lanl.gov>
- Date: Tue, 24 Mar 2009 05:31:26 -0500 (EST)
- Organization: LANL
- References: <200903230905.EAA27168@smc.vnet.net>
- Reply-to: cfo at lanl.gov
singleCharToNumber[string_] := First[ToCharacterCode[ToString[string]] - 96] singleCharToNumber[a] singleCharToNumber[b] singleCharToNumber[z] Out[21]= 1 Out[22]= 2 Out[23]= 26 Of course, that will treat capitalized characters "strangely", but I'm sure you can cope with that case :) --C.O. On Monday 23 March 2009 03:05:04 am Fabrizio wrote: > 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 > > -- ========================================================== Curtis Osterhoudt cfo at remove_this.lanl.and_this.gov PGP Key ID: 0x4DCA2A10 Please avoid sending me Word or PowerPoint attachments See http://www.gnu.org/philosophy/no-word-attachments.html ==========================================================
- References:
- Got a tip ?
- From: Fabrizio <Tekcitizen@hotmail.com>
- Got a tip ?