Delphi 搜索字符串


本文整理自网络,侵删。

 
搜索字符串:

//--------------------------------------------------------------------------------
var
  str: string;
  n: Integer;
begin
  str := 'A1 A2 A3 A4';

  n := str.IndexOf('A');     // 0
  n := str.LastIndexOf('A'); // 9
  n := str.IndexOf('B');     // -1; 没找到

  n := str.IndexOf('A', 1, str.Length - 1);                  // 3
  n := str.LastIndexOf('A', str.Length - 1, str.Length - 1); // 9

  n := str.IndexOfAny(['1', '2', '3', '4']);     // 1
  n := str.LastIndexOfAny(['1', '2', '3', '4']); // 10
end;

相关阅读 >>

Delphi xe8 为image设置渐变效果

Delphi文件监视主单元文件

Delphi使用ado读写excel文件

Delphi firedac 下的 sqlite [1] - 前言

Delphi之memo组件

Delphi实现双击左ctrl键调用记事本

Delphi webbrowser 加载html 将html代码转换成网页

tidhttpresponseinfo 中文乱码问题解决

Delphi xe5 for android ttabcontrol 控件

Delphi整理八(对话框)

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



打赏

取消

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

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

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

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

评论

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