Re: Got a tip ?
- To: mathgroup at smc.vnet.net
- Subject: [mg97883] Re: Got a tip ?
- From: David Bailey <dave at removedbailey.co.uk>
- Date: Tue, 24 Mar 2009 05:34:25 -0500 (EST)
- References: <firstname.lastname@example.org>
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 > > . > > 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. What 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 help is much appreciated. > I think you need to be a bit more specific - for example, what should these return: f["foo"] f[""] f["\n\n\n\n\n\[Breve]"] You might want to explore the function ToCharacterCode. David Bailey http://www.dbaileyconsultancy.co.uk