RSS订阅 | 匿名投稿
您的位置:网站首页 > 字符串 > 正文

delphi 过滤字符串首位特殊符号

作者:admin 来源: 日期:2018/2/15 17:50:19 人气: 标签:

// 用法:ShowMessage (TrimEx('<MegaTeg>', '<>'));

function TrimEX(Word, TrimSymbols: string): string;

var

x, a, b: Integer;

begin

Result := Word;

if TrimSymbols = '' then

   exit;

Word := Trim(word);

if length(word) = 0 then

   exit;

 

x := 0;

repeat

   x := x + 1;

until (pos(ansiuppercase(word[x]), ansiuppercase(TrimSymbols)) = 0)

   or (x = length(word));

a := x;

 

x := length(word) + 1;

repeat

   x := x - 1;

until (pos(ansiuppercase(word[x]), ansiuppercase(TrimSymbols)) = 0)

   or (x = 1);

b := x;

 

word := copy(word, a, b - a + 1);

result := word;

end;


读完这篇文章后,您心情如何?
0
0
0
0
0
0
0
0
本文网址:
下一篇:没有资料