Morthawt Posted May 7, 2011 Posted May 7, 2011 How do you get the data from a variable and transfer the data to another variable while knocking off the first 2 characters? For example if the variable data is 0x12345678 how can I make a new variable that only has the 12345678 part and removed the initial 0x Thanks Free and easy Autoit scripting video tutorials (plus more videos always coming!) General video tutorials, especially correct and safe TeamSpeak permissions tutorials.
bogQ Posted May 7, 2011 Posted May 7, 2011 (edited) Assuming that its a string $a = "0x12345678" $b = StringRight($a,StringLen($a)-2) MsgBox(0,"",$b) Edit, some other method can b StringSplit StringReplace Edited May 7, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.
Morthawt Posted May 7, 2011 Author Posted May 7, 2011 Thanks. Well if it is treated as a string, won't it just work no matter what the containing data type is? I mean, a character is a character right? Free and easy Autoit scripting video tutorials (plus more videos always coming!) General video tutorials, especially correct and safe TeamSpeak permissions tutorials.
bogQ Posted May 7, 2011 Posted May 7, 2011 (edited) If variable data is string type it`l work $a = "0x12345678" $b = 0x12345678 MsgBox(0,$a,$b) $a = 0x12345678 $b = StringRight($a,StringLen($a)-2) $c = "0x12345678" $d = StringRight($c,StringLen($c)-2) MsgBox(0,$b,$d) Edited May 7, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.
Malkey Posted May 7, 2011 Posted May 7, 2011 Some more examples. $a = 0x12345678 $b = hex($a) $c = "0x12345678" $d = StringTrimLeft($c, 2) MsgBox(0,"Results","$b = " & $b & @CRLF & "$d = " & $d )
Moderators SmOke_N Posted May 7, 2011 Moderators Posted May 7, 2011 Some more examples. $a = 0x12345678 $b = hex($a) $c = "0x12345678" $d = StringTrimLeft($c, 2) MsgBox(0,"Results","$b = " & $b & @CRLF & "$d = " & $d ) Hex() would probably work on the string as well. 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now