I have an output that is basically a paragraph and when I try to search the string for a substring, if that substring is split up it doesnt' work. How can I make the paragraph string into just 1 line?
Example string:
I have an output that is basically a paragraph and when I try
to search the string for a substring, if that substring is split up it
doesn't work. How can I make the paragraph string into just 1 line?
substring: "it doesn't work"
When I try to search for that substring, it doesn't return true.
It seems like you want to treat newlines as spaces. Writing efficient search algorithms is not trivial, but an approach that works and answers the question in your title, is
str := StringReplace(str, sLineBreak, ' ', [rfReplaceAll]);
That is, we simply replace all linebreaks with spaces. Without the magic constants, this is
str := StringReplace(str, #13#10, #32, [rfReplaceAll]);
Perhaps there are already spaces between the words, in addition to the linebreaks? Then just remove the linebreaks, without adding spaces:
str := StringReplace(str, #13#10, '', [rfReplaceAll]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With