本文整理自网络,侵删。
//SysUtils.LastDelimiter
声明:function LastDelimiter ( const Delimiters, Source : string ) : Integer;描述:LastDelimiter函数查找在Source字符串中Delimiter集合中任一字符最后出现的位置。如果找到,则返回位置值,否则,返回0。备注:字符串第一个字符开始于1。
var source, find : string; position : Integer; begin // 创建一个字符串 source := '12345678901234567890'; // 查找最后一个“1”的位置 position := LastDelimiter('1', source); ShowMessage('The last 1 is at '+IntToStr(position)); // 查找2,4或6最后出现的位置 position := LastDelimiter('246', source); ShowMessage('The last 2, 4 or 6 is at '+IntToStr(position)); end;程序运行结果:
The last 1 is at 11
The last 2, 4 or 6 is at 16
相关阅读 >>
Delphi 获取动态创建的image与scrollbox的相对位置
Delphi防止因系统崩溃而丢失任务栏的图标(重建托盘图标)
Delphi xe 新功能试用:多种皮肤样式静、动态设置方法
更多相关阅读请进入《Delphi》频道 >>