Sources
Delphi Russian Knowledge Base
DRKB - база знаний по Дельфи в рунете, составленная Виталием Невзоровым

Как удалить переносы из строки?

01.01.2007
Vit

Вариант 1:

Source: DelphiWorld 6.0 https://delphiworld.narod.ru/

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;

Вариант 2:

Author: Vit

Можно значительно проще:

function DeleteLineBreaks(const S: string): string;


begin
  Result := StringReplace(S, #10#13, '',[rfReplaceAll]);
end;
Previous page:
Удаление лишних пробелов в строке
Top:
DRKB
Next page:
Удаление пробелов в начале строки