Problems with StringReplace


2006-09-06 04:30:57 PM
cppbuilder2
1) lots_of_rtf_text=StringReplace(lots_of_rtf_text,
"\\par \r\n\\par ","\\par",
TReplaceFlags()<<rfReplaceAll)
does not replace any occurences in the AnsiString lots_of_rtf_text, but works
if I do it like this :-
int ii=lots_of_rtf_text.Pos("\\par \r\n\\par ");
while (ii>0)
{
lots_of_rtf_text.Delete(ii,12);
lots_of_rtf_text.Insert("\\par ",ii);
ii=lots_of_rtf_text.Pos("\\par \r\n\\par ");
}
Why does StringReplace fail in this case?
2) StringReplace(text_with_4500_lines,"\n","",TReplaceFlags()<<rfReplaceAll)
takes an incredibly long time to return - much much longer than to read those
lines in from the file. Why?
--
Mark Jacobs
DK Computing
www.dkcomputing.co.uk