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 webbrowser中模拟连接点击(非鼠标模拟)

Delphi not 与整数

Delphi xe5 json与Delphi object的互换

Delphi中隐藏程序进程

Delphi win7中的uac与开机自动启动

Delphi unigui 获取当前ip

Delphi types of actual and formal var parameters must be identical

Delphi sysutils.comparestr、sysutils.comparetext - 字符串比较

Delphi (vcl及fmx[firemonkey])启动时的欢迎窗口实现代码

Delphi 字符串处理单元

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



打赏

取消

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

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

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

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

评论

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