本文整理自网络,侵删。
// 用法: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;
相关阅读 >>
Delphi 的编译指令(1): $define、$undef、$ifdef、$else、$endif
Delphi中的处理事件 application.processmessages
Delphi datetimetogmt gmt时间与tdatetime转换
更多相关阅读请进入《Delphi》频道 >>