Sign in to follow this  
Followers 0
SmOke_N

Giving a number a differnet value?

3 posts in this topic

Hey all, I thought I saw a few days ago a similar post, but I can't seem to find it.

I'm trying to get a variable to translate to a different value.

$var = "1234567890"

Trying to give each number a specific value like this.

1 = "h"

2 = "I"

3 = "3"

4 = "R"

5 = "J"

6 = "6"

7 = "b"

8 = "Z"

9 = "9"

0 = "00"

So if you got $var = "1234567890" and translated it to = "hI3RJ6bZ900" or if you had $var = 22315994 it would be "II3hJ99R".

I'm sure it's using the arrays, but my homework is lacking today (besides I suck at them).

Any help is appreciated.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites



Dim $Codes[10]
$Codes[0] = "00" 
$Codes[1] = "h"
$Codes[2] = "i"
$Codes[3] = "3"
$Codes[4] = "R"
$Codes[5] = "j"
$Codes[6] = "6"
$Codes[7] = "b"
$Codes[8] = "Z"
$Codes[9] = "9"
;
$var = "1234567890"
$Out_Var = ""
For $x = 1 to StringLen($var)
    $i = number(StringMid($var,$x,1))
      $Out_Var = $Out_Var & $Codes[$i]
Next
MsgBox(0,'test',$Out_Var)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks and that was quick: Ask for help get the "answer". I'll study this so that I can understand exactly what you did!! :)

Thanks again JdeB :evil:

Edit: Wish I could spell!!

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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