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处理http请求自定义header

Delphi使用json解析调用淘宝ip地址库rest api 示例

Delphi tstringdynarray 使用,分割字符串

Delphi webbrowser中模拟连接点击(非鼠标模拟)

Delphi adoquery的post和updatebatch

Delphi 获取超gb大文件大小

Delphi fmx用timage显示不同格式的图片

减小Delphi xe5编译出来的程序体积

Delphi fmx窗体中控件对齐方式介绍

Delphi转换 tcolor 到 html 颜色串

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



打赏

取消

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

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

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

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

评论

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