Sign in to follow this  
Followers 0
Newbie2

How To Map To Alphabetical Letters?

8 posts in this topic

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? :whistle:

Example:

A = 41

B = 42

.

.

.

.

J=49

etc...

Share this post


Link to post
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", ",")
;Read from the array
    Msgbox(0,"","C is = " & $aLetter[3])

Is any of this what you mean? :whistle:

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

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 this post


Link to post
Share on other sites

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

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites

#8 ·  Posted (edited)

B) Jon / Larry, I Like You In a Way That is Appropriate! :angry:

EDIT: This post has been moderated :whistle::evil:

Edited by Larry

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0