Newsgroups : Borland : borland.public.delphi.rtl.win32 : 2005 Aug : TStrings Problem
| Subject: | TStrings Problem |
| Posted by: | "Andrew Cave" (andrew_ca..@tiscali.co.uk) |
| Date: | 7 Aug 2005 06:25:30 |
In upgrading from D5 to D2005 and attempting to replace the
Psock method “nthWord” with the TstringList.DelimitedText, with
the Delimiter = ‘;’ . Equating the string
“this is first;this is second;and soforth”.
Results in the strings count equal to 8, not 3.
Examination of the Tstrings.SetDelimitedText method shows why
this is, but the logic is odd.
This first curious line is
while P^ in [#1..' '] do iterate through P until P^ greater
than ‘ ‘.
Why are characters 1 to 32 not considered as legitimate
character? To insert a new line in a string, insert #13#10.
The next curious line is
while (P^ > ' ') and (P^ <> Delimiter) do iterate through P until P^ = QuoteChar.
Again, why is #32 not considered as part of the string?
Further, what about the other non-printing characters above #127?
As a work around could the lines be modified to
while P^ in [#1..#31] do and
while (P^ >= ' ') and (P^ <> Delimiter)do?