How to remove line breaks from text in Delphi?
You can use stringreplace function.
- function StringReplace (const SourceString, OldPattern, NewPattern : string; Flags : TReplaceFlags) : string;
The Flags may be none, one, or both of these set values:
- rfReplaceAll : Change all occurrences
- rfIgnoreCase : Ignore case when searching
Below are the sample code :
var before, after : string; begin before:='Some text with' + #10#13 + 'line break'; after := StringReplace(StringReplace(before, #10, ' ', [rfReplaceAll]), #13, ' ', [rfReplaceAll]); ShowMessage(before); ShowMessage(after); end;
No comments:
Post a Comment