- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi 合并文本行的函数
function DeleteLineBreaks(const S: string): string;
var
Source, SourceEnd: PChar;
begin
Source := Pointer(S);
SourceEnd := Source + Length(S);
while Source < SourceEnd do
begin
case Source^ of
#10: Source^ := #32;
#13: Source^ := #32;
end;
Inc(Source);
end;
Result := S;
end;
补充第二种方法:
function DeleteLineBreaks(const S: string): string;
begin
Result := StringReplace(S, #13#10, '',[rfReplaceAll]);
end;