本文整理自网络,侵删。
//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 android实例-红外线操作(xe10.2+小米5)
更多相关阅读请进入《Delphi》频道 >>