Originally Posted by
Chebmaster
Things like this
[pascal]while (IText <Length> #32) do
begin
Part := Part+Text[IText]; [/pascal]
kill performance on the spot. Brutally.
EACH time you add a char to a string, a call to realloc its memory is performed. So you can imagine how "fast" will this code execute.
Ideally, you should make two passes. The first one determines subsstring lengths and positions, the second pass allocates memory by calling SetLength for destination strings (once!) and copies the characters.
Bookmarks