字符串截取小例子Delphi源代码


本文整理自网络,侵删。

 function getstr(Ystr,Mstr:string;istar:byte):string; //从字符串中截取字符串 delphitop.com
var s:string;
i:byte;
begin
result:='';
i:=0;
for i:=0 to length(Ystr) do
if i<istar then
delete(Ystr,1,pos(Mstr,Ystr)) else
break;
s:=copy(Ystr,i-strtoint(form1.edit4.text)-1,pos(Mstr,Ystr)-1);
delete(s,1,length(Mstr)-1);
if s<>'' then
result:=s else
result:='提取串为空串!'
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
edit2.Text:=getstr(edit1.Text,edit3.text,strtoint(edit4.text));
end;

procedure TForm1.Edit4KeyPress(Sender: TObject; var Key: Char);
begin
if (Key < '0') or (Key > '9')
then Key := Chr(0);
end;

相关阅读 >>

Delphi根据窗口句柄获取所在程序路径

Delphi 多种编码转换

Delphi 获取网卡mac为软件注册机器码

Delphi 外挂编写的几个api函数

Delphi win10系统通知 notificationcenter1 基本用法

Delphi 简单的操作memo1剪切 复制 粘贴 撤销 全选 清空

Delphi 10.2 创建并使用资源文件

Delphi tstringstream 简单用法

Delphi 访问https图片

idftp tencoding and iidtextencoding

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



打赏

取消

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

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

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

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

评论

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