![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | string to hex value How do I go about converting a string value to Hex? I don't know if there is something built in. I did start writng the code with a for loop but I feel that I am doing it the hard way. I am thinking I would be able to pass in a value of 01 the function would return back 30 31. For example, String = 01 HexValue=30 31 If String was 11 HexValue=31 30 ----------Code snippet of my approach which I feel is not efficient.------------ For k = 30 To 39 '0-9 For j = 30 To 39 '0-9 Next Next |
My System Specs![]() |
| | #2 (permalink) |
| | Re: string to hex value "Big D" <BigDaddy@xxxxxx> wrote in message news:uZkif0T$IHA.4800@xxxxxx Quote: > How do I go about converting a string value to Hex? I don't know if there > is something built in. I did start writng the code with a for loop but I > feel that I am doing it the hard way. I am thinking I would be able to > pass in a value of 01 the function would return back 30 31. > > > For example, > String = 01 > HexValue=30 31 > > If String was 11 > HexValue=31 30 > > > ----------Code snippet of my approach which I feel is not > efficient.------------ > For k = 30 To 39 '0-9 > For j = 30 To 39 '0-9 > Next > Next name = "012345 Big D" line = "" For i = 1 To Len(name) line = line & Asc(Mid(name, i, 1)) & " " Next WScript.Echo line |
My System Specs![]() |
| | #3 (permalink) |
| | Re: string to hex value On Aug 13, 8:24 am, "Pegasus \(MVP\)" <I....@xxxxxx> wrote: Quote: > "Big D" <BigDa...@xxxxxx> wrote in message > > news:uZkif0T$IHA.4800@xxxxxx > > > Quote: > > How do I go about converting a string value to Hex? I don't know if there > > is something built in. I did start writng the code with a for loop but I > > feel that I am doing it the hard way. I am thinking I would be able to > > pass in a value of 01 the function would return back 30 31. Quote: > > For example, > > String = 01 > > HexValue=30 31 Quote: > > If String was 11 > > HexValue=31 30 Quote: > > ----------Code snippet of my approach which I feel is not > > efficient.------------ > > For k = 30 To 39 '0-9 > > For j = 30 To 39 '0-9 > > Next > > Next > Use the inbuilt Asc function, e.g. like so: > name = "012345 Big D" > line = "" > For i = 1 To Len(name) > line = line & Asc(Mid(name, i, 1)) & " " > Next > WScript.Echo line line = line & Hex(Asc(Mid(name, i, 1))) & " " Tom Lavedas =========== http://members.cox.net/tglbatch/wsh/ |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Find a string within a variable string | PowerShell | |||
| problems with $var | select-string -pattern $string -q | PowerShell | |||
| How export-csv deals with string versus string[] | PowerShell | |||
| String PRODUCT_NAME was not found in string table | Vista General | |||