码迷,mamicode.com
首页 > Windows程序 > 详细

delphi 过滤开头 结尾 全部 空格的函数

时间:2018-02-15 16:55:53      阅读:272      评论:0      收藏:0      [点我收藏+]

标签:span   style   while   result   phi   pos   else   class   blog   

function TrimAnsi(const S: AnsiString): Ansistring;
var
  I, L: Integer;
begin
  L := Length(S);
  I := 1;
  while (I <= L) and (S[I] <=  ) do Inc(I);
  if I > L then Result := ‘‘ else
  begin
    while S[L] <=   do Dec(L);
    Result := Copy(S, I, L - I + 1);
  end;
end;

function TrimLeftAnsi(const S: AnsiString): AnsiString;
var
  I, L: Integer;
begin
  L := Length(S);
  I := 1;
  while (I <= L) and (S[I] <=  ) do Inc(I);
  Result := Copy(S, I, Maxint);
end;

function TrimRightAnsi(const S: Ansistring): AnsiString;
var
  I: Integer;
begin
  I := Length(S);
  while (I > 0) and (S[I] <=  ) do Dec(I);
  Result := Copy(S, 1, I);
end;

 

delphi 过滤开头 结尾 全部 空格的函数

标签:span   style   while   result   phi   pos   else   class   blog   

原文地址:https://www.cnblogs.com/westsoft/p/8449598.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!