Page 1 of 1

How To Parse A String That May Contain Unicode

Posted: Thu May 18, 2006 12:29 am
by DickBryant
To preface - I'm in the process of converting a very large application and trying to retain as much of the structure as possible. If I were writing this from scratch to be Unicode compatible I would do a lot of things differently!

That said, I have a string that may contain Unicode substrings like this:

<unicode1>***<unicode2>***<unicode3>

The <unicoden>'s all came from separate TRichViews and were transferred to a single TRVTableCellData using AddTextNLA calls.

How can I then parse the unicode string that I end up with in another section of the program to wind up with

<unicode1>
<unicode2>
<unicode3>

as distinct strings again? In the non-unicode progam I simply find the POS of the first '***' separator an copy up to it, thus getting <unicode1>, delete to the end of the first separator, repeat, etc. However I don't see any unicode-capable commands to do this type of parsing built into Delphi. Are there any tools in the TRichView utilities that would help with this?

Thanks

Posted: Thu May 18, 2006 5:05 pm
by Sergey Tkachenko
You can find a set of functions for Unicode strings here:
http://www.delphi-gems.com/UnicodeLibrary.php

Posted: Fri May 19, 2006 2:30 am
by DickBryant
Thank you. That was exactly what I was looking for!