Re: Got a tip ?
- To: mathgroup at smc.vnet.net
- Subject: [mg97861] Re: Got a tip ?
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Tue, 24 Mar 2009 05:30:16 -0500 (EST)
- References: <gq7jbp$qgp$1@smc.vnet.net>
ToCharacterCode[ ] returns the ASCII values of the characters that make up the string that it gets as argument. If you only use lowercase characters, you then subtract 96 to end up with values starting at 1. Another function that may be useful to you is Characters[ ], which splits a string in a list of characters. Module and Block are totally irrelevant in this context. Cheers -- Sjoerd On Mar 23, 11:04 am, Fabrizio <Tekciti... at hotmail.Com> wrote: > Hello, > > I want to write a function that translates its argument (which is a lette= r of the alphabet) into a numerical value. > > f[a] = 1 > f[b] = 2 > > . > > If this small module is finished, i want to expand the function by giving= as an argument; a string of letters (or a text), but i have no clue which = functions i have to use to define the smaller part (only letters) first. Wh= at functions can i use for all of this and how do i handle the variables ? = Does the difference between Module and Block come into play ? Or . . .any h= elp is much appreciated.