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


本文整理自网络,侵删。

 
// 用法: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 复制文件到全盘

Delphi fmx jpg 保存数据库 从数据库读取

Delphi 免杀下载者代码

Delphi中使用词霸2005的动态库xdictgrb.dll实现屏幕取词

Delphi xe4 for ios 谨慎处理字符串

Delphi xe8 numberbox使用方法及存在的问题

Delphi xe10 安卓设备信息

Delphi提取字符串

Delphi mainmenu控件 checkde属性用法

Delphi防止因系统崩溃而丢失任务栏的图标(重建托盘图标)

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...