How To Parse A String That May Contain Unicode

General TRichView support forum. Please post your questions here
Post Reply
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

How To Parse A String That May Contain Unicode

Post 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
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can find a set of functions for Unicode strings here:
http://www.delphi-gems.com/UnicodeLibrary.php
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Post by DickBryant »

Thank you. That was exactly what I was looking for!
Post Reply