House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home / Groups / ColdFusion Talk (CF-Talk)

Convert Letters to Numbers in Phone Numbers

Author:
Sean Corfield
12/04/2007 05:44 PM

On Dec 4, 2007 8:05 AM, Deepak Gupta <deepak24@gmail.com> wrote: > Can anyone tell me or  point me to a Macro or coldfusion code to convert letters to numbers on phone keypad. For example > > ABDG will be 2234 > > And this way I have a lot of Names in database and I have to pick first 4 letters from the name and convert them into 4 digit codes from phone keypad. Create a struct with 26 keys (the letters of the alphabet) and values for the digits on the phone. Then you just use lookup[letter] and get back the value. In CF8 this would be: lookup = { a=2, b=2, c=2, d=3, e=3, f=3, g=4, h=4, i=4, j=5, k=5, l=5, m=6, n=6, o=6, p=7, q=7, r=7, s=7, t=8, u=8, v=8, w=9, x=9, y=9, z= 9 }; -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ "If you're not annoying somebody, you're not really alive." -- Margaret Atwood


Search cf-talk

August 29, 2014

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
           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 27 28 29 30
31             

Designer, Developer and mobile workflow conference