Re: Got a tip ?
- To: mathgroup at smc.vnet.net
- Subject: [mg97876] Re: Got a tip ?
- From: "Hans Michel" <hmichel at cox.net>
- Date: Tue, 24 Mar 2009 05:33:06 -0500 (EST)
- References: <gq7jbp$qgp$1@smc.vnet.net>
You have stated what you want to do; since, it is not clear what problem you are trying to solve I point to the Mathematica built in function ToCharacterCode[] Plus[Plus[ToCharacterCode[ToLowerCase["abcdefghijklmnopqrstuvwxyz"]], -32] -64] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26} For uppercase Plus[ToCharacterCode["ABCDEFGHIJKLMNOPQRSTUVWXYZ"], -32] {33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, \ 52, 53, 54, 55, 56, 57, 58} Hans "Fabrizio" <Tekcitizen at hotmail.Com> wrote in message news:gq7jbp$qgp$1 at smc.vnet.net... > 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. >