Delphi-Help

  • Increase font size
  • Default font size
  • Decrease font size
Главная Статьи Текст и Строки Как удалить переносы из строки?

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

Оцените материал
(1 Голосовать)

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

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, #10#13, '',[rfReplaceAll]);
end;
Прочитано 6882 раз

Авторизация



Счетчики