Delphi判断字符串是否包含限制以外的字符 否则置空


本文整理自网络,侵删。

 
判断字符串是否包含限制以外的字符 否则置空
procedure TMainForm.cbSearchExit(Sender: TObject); //判断退出事件
var
J:Integer;
K:String;
begin
 K := TsEdit(Sender).Text;
for J:=1 to Length(K) do 
begin
if not(K[J] in ['0'..'9','a'..'z','A'..'Z']) then 
begin
TsEdit(Sender).Text:='';
end;
end;
end;
可以使用下列方法将不符合的字符突出显示出来
TsEdit(ctl).SelectAll
TsEdit(ctl).SelLength
TsEdit(ctl).SelStart
TsEdit(ctl).SelText
――――――――――――――――

原文链接:https://blog.csdn.net/u010431493/article/details/79785430

相关阅读 >>

Delphi fileopendialog1 多选加载大量文件,不受中文文件名影响

Delphi vclzip实现分卷压缩

Delphi tdsauthenticationmanager的用法

Delphi 字符串截取

Delphi 中文字符串截取

Delphi版 随机窗口类名

Delphi dbgrid中实现copy、paste功能

Delphi 10.3 中安装程序自动升级插件autoupgrader_pro_v5.2

idftp tencoding and iidtextencoding

Delphi 读取dll所有输出函数名

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



打赏

取消

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

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

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

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

评论

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