Jump to content

How To Map To Alphabetical Letters?


Newbie2
 Share

Recommended Posts

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:

Link to comment
Share on other sites

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
Link to comment
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?

Link to comment
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

Link to comment
Share on other sites

  • Administrators

$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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...