Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unicode string parsing? Please help!
I am trying to parse a string and create a list of character codes. For
example, "MUM" converts to " 0x004D, 0x0055, 0x004D" With ascii text, I have accomplished this with Hex(Asc(Mid(asciiString, i, 1)). How can I do something similar with double-byte text such as Korean where these ascii functions no longer apply? Thanks, Douglas Gennetten |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unicode string parsing? Please help!
Hi Douglas
Nowadays, every VBA-string is UNICODE but VBA hides this situation from you (mostly, that is). However, there are functions able to deal with this: AscB(...) -- Returns the ASCII-code for a given byte MidB(...) -- Returns a byte (not a character) With these, you can write something like (Immediate window): ?AscB(MidB("Hello world",1,1)) 72 ?AscB(MidB("Hello world",2,1)) 0 ?AscB(MidB("Hello world",3,1)) 101 As you can see, MidB lets you access all the bytes of the 16-Bit Unicode-string and not just every second one as the normal Mid-function seems to do. However, you may have to jump over the codepage-values (every second byte, in the above example the 0-values) yourself... Cheers, Martin There should be "Douglas Gennetten" schrieb im Newsbeitrag ... I am trying to parse a string and create a list of character codes. For example, "MUM" converts to " 0x004D, 0x0055, 0x004D" With ascii text, I have accomplished this with Hex(Asc(Mid(asciiString, i, 1)). How can I do something similar with double-byte text such as Korean where these ascii functions no longer apply? Thanks, Douglas Gennetten |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Parsing / seperating text string in excel cell | Excel Discussion (Misc queries) | |||
parsing on a date string pulled from a database. | Excel Discussion (Misc queries) | |||
Parsing a text string into separate cells | Excel Worksheet Functions | |||
String parsing with variable lenght strings | Excel Worksheet Functions | |||
Parsing when deliminator is a string | Excel Worksheet Functions |