How To Map To Alphabetical Letters?

Recommended Posts

Hey,

I was wondering if there is a way to map the alphabetical letters into an array.

Can I "increment" a Letter in order to put it in a loop for the array?

Example:

A = 41

B = 42

.

.

.

.

J=49

etc...

Share on other sites

```Hex(Asc("A"),4) = "0041"

Asc("A") = 65
Chr(65) = "A"```

.. so you could loop from 65, incrementing by one, and to get the character equivalent, you pass it to Chr():

```for \$nX = Asc("A") to Asc("J")
Msgbox(0,\$nX, Chr(\$nX))
Next```

If you desparately want to use an array ..

```;Load the array
\$aLetter = StringSplit("A,B,C,D,E,F,G,H,I,J", ",")
Msgbox(0,"","C is = " & \$aLetter[3])```

Is any of this what you mean?

Share on other sites

10x. It's almost it. I want to map all the followings.

0041=A

0042=B

0043=C

0044=D

0045=E

0046=F

0047=G

0048=H

0049=I

004A=J

004B=K

004C=L

004D=M

004E=N

004F=O

0050=P

0051=Q

0052=R

0053=S

0054=T

0055=U

0056=V

0057=W

0058=X

0059=Y

005A=Z

Edited by Newbie2

Share on other sites

Be careful: 0041 is the hex for 65. And is expressed as a string in au3.

So .. "A" = Chr(Dec("0041"))

Or .. "0041" = Hex(Asc("A"),4) ;4 = length of resulting string

Can you give an example of how you want to use the mapping you refer to?

Share on other sites

10x Jon / Trids

All I wanna do is when the user enter's an alphabetical letter in an InputBox, a result will be desplayed in a msgbox according to the following pattern:

For example:

If the input letter is: "M", the result should be "004D"

Mapping pattern:

0041=A

0042=B

0043=C

0044=D

0045=E

0046=F

0047=G

0048=H

0049=I

004A=J

004B=K

004C=L

004D=M

004E=N

004F=O

0050=P

0051=Q

0052=R

0053=S

0054=T

0055=U

0056=V

0057=W

0058=X

0059=Y

005A=Z

Share on other sites

\$input = InputBox("Input", "Enter a letter")

\$input = StringLeft(StringUpper(\$input), 1)

\$result = "00" & Hex(Asc(\$input), 2)

MsgBox(0, "Result", \$result)

It will make sure the input only uses the first letter and also makes sure it is a capital.

Share on other sites

Jon / Larry, I Like You In a Way That is Appropriate!

EDIT: This post has been moderated

Edited by Larry

Create an account

Register a new account