Letters to Numbers

1. Senior Member
Join Date
Dec 1969
Posts
141

## Letters to Numbers

OK, Im pulling some letters from the URL , declaring a variable of those letters, what I need to do now is convert those letters to numbers using certain #&#039;s for certain letters,<BR>Anyone able to get me started on that?

2. Senior Member
Join Date
Dec 1969
Posts
11,334

## RE: Letters to Numbers

Asc("A") = 65<BR><BR>Or are you using a certain number for each letter?<BR><BR>Use a 2-d array...<BR><BR>myArray(0,0) = "A"<BR>myArray(0,1) = 23

3. Senior Member
Join Date
Dec 1969
Posts
141

## RE: Letters to Numbers

yes , like F=1, G=2 and so on

4. Senior Member
Join Date
Dec 1969
Posts
141

## RE: Letters to Numbers

Asc = ?<BR>the variable is the thing I need to convert, So if I pull in ABCDE,ABCDE is my variable Then I need to take that and convert it to 12345,<BR><BR>Sorry if I wasnt clear enough , I hardly ever are.

5. Senior Member
Join Date
Dec 1969
Posts
11,334

## You have to do it one char at a time

myArray = Array("crap value to kill the 0", "A","B","C"...)<BR><BR>Dim myNumberString<BR><BR>For i = 1 to Len(thatstring)<BR> For j = 1 to UBound(myArray)<BR> If myArray(j) = mid(thatstring, j, j + 1) Then<BR> myNumberString = myNumberString & mid(thatstring...)<BR> End If<BR> Next<BR>Next<BR><BR>or something like that..... off the top of my head, so there&#039;s probably some errors.

6. Senior Member
Join Date
Dec 1969
Posts
11,334

## Irk

If myArray(j) = mid(thatstring, j, j + 1) Then<BR>myNumberString = myNumberString & j<BR>Exit For<BR>End If<BR><BR>Forgot to put the number in there.... hey, it&#039;s Friday.<BR>

7. Senior Member
Join Date
Dec 1969
Posts
11,334

## Or better yet

If you know you&#039;re only using captial letters....<BR><BR><BR>For i = 1 to Len(thatString)<BR> myNumber = myNumber & CStr(Asc(mid(thatstring, i, i + 1)- 64))<BR>Next<BR><BR>

8. Senior Member
Join Date
Dec 1969
Posts
11,334

## A bug

I give up on this post... I&#039;m just screwing it up worse.<BR><BR>myNumber = myNumber & CStr(Asc(mid(thatstring, i, i + 1))- 64)<BR><BR>Good Luck.

9. Senior Member
Join Date
Dec 1969
Posts
141

## RE: Irk

Ok, help me out here a little, please , my variable is named tracking, the variable changes for each different person that hits the site, the variable never stays the same , so my question now is how do I write it like <BR>:<BR>If myArray(j) = mid(thatstring, j, j + 1) Then<BR>myNumberString = myNumberString & j<BR>Exit For<BR>End If<BR><BR>here are the letter to number codes.<BR>F = 1<BR>G = 2 <BR>H = 3 <BR>I = 4 <BR>J = 5 <BR>U = 6 <BR>T = 7 <BR>S = 8 <BR>R = 9 <BR>Q = 0

10. Senior Member
Join Date
Dec 1969
Posts
141

## RE: Or better yet

yes it will be only upper case

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•