eyegeegeewhy Posted March 31, 2008 Posted March 31, 2008 I want to convert a string into what I think is binary , although I might be using the wrong terminology. Ive tried "binery" in Autoit but the output i want wants to look something like "01000100100010100101010" whist the results i get look more "0x68656C6C6F207468657265" How do I make it so that it is just 0 and 1's Regards Jordan
weaponx Posted March 31, 2008 Posted March 31, 2008 This function will show binary in raw form:http://www.autoitscript.com/forum/index.ph...decimal++binary
eyegeegeewhy Posted March 31, 2008 Author Posted March 31, 2008 Hi Thanks that looks good for numbers but is there a way for doing to same with text? cheers
weaponx Posted March 31, 2008 Posted March 31, 2008 HiThanks that looks good for numbers but is there a way for doing to same with text?cheersYou want to convert text a number first? Use _StringToHex()
Richard Robertson Posted March 31, 2008 Posted March 31, 2008 Text is represented in binary based on it's encoding. What encoding do you want? ASCII? Unicode? Something else?
eyegeegeewhy Posted April 1, 2008 Author Posted April 1, 2008 Text is represented in binary based on it's encoding. What encoding do you want? ASCII? Unicode? Something else?i think the encoding i want is binary. I want it so that it only uses 0 & 1's
Richard Robertson Posted April 1, 2008 Posted April 1, 2008 Binary isn't an encoding. Encoding means the representation of the character set in byte form. ASCII is a single byte character system, Unicode is a double byte character system. An example, 'A' = 65, 65 = 01000001.
PsaltyDS Posted April 1, 2008 Posted April 1, 2008 (edited) Demo:$sChar = Chr(0191) ConsoleWrite("$sChar = " & $sChar & @LF) $iAsc = Asc("¿") ConsoleWrite("$iAsc = " & $iAsc & @LF) $sHex = "0x" & Hex(191, 4) ConsoleWrite("$sHex = " & $sHex & @LF) $sbinHex = _HexToBinaryString($sHex) ConsoleWrite("$sbinHex = " & $sbinHex & @LF) Func _HexToBinaryString($Input) Local $avBinaries[16] = ["0000", "0001", "0010", "0011", "0100", "0101", "0110", _ "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"] Local $sRET = "" If StringLeft($Input, 2) = "0x" Then $Input = StringTrimLeft($Input, 2) For $n = 1 To StringLen($Input) $sRET &= $avBinaries[Number("0x" & StringMid($Input, $n, 1))] Next Return $sRET EndFunc Edited April 1, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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