Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Parsing / seperating text string in excel cell sfleck Excel Discussion (Misc queries) 7 November 16th 07 12:24 AM
parsing on a date string pulled from a database. Zone99 Excel Discussion (Misc queries) 3 July 9th 07 11:49 PM
Parsing a text string into separate cells Bobalew Excel Worksheet Functions 1 June 6th 07 09:16 PM
String parsing with variable lenght strings frosterrj Excel Worksheet Functions 10 March 31st 06 11:46 PM
Parsing when deliminator is a string Rose Excel Worksheet Functions 5 December 14th 04 12:54 AM


All times are GMT +1. The time now is 02:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"