描述:
查找母串中子串的位置。
语法:
pos(s1, s2{, begin})
备注:
查找母串s1中起始位置为begin的子串s2的位置,找不到返回null。
参数:
s1 |
待查找子串的母串。 |
s2 |
被查找的子串。 |
begin |
查找的起始位置,缺省为1。 |
返回值:
整型
选项:
@z |
由begin开始往前查找,缺省从begin开始往后查找。 |
@c |
大小写不敏感。 |
@h |
只比头部,忽略begin。 |
@q |
引号内的跳过。 |
示例:
pos("abcdef","def") |
4 |
pos("abcdefdef","def",5) |
7 |
pos("abcdef","defa") |
(null) |
pos@z("abcdeffdef","def",7) |
4 |
pos("abcdeffdef","def",7) |
8 |
pos@c("abcdef","Def") |
4,使用@c选项大小写不敏感。 |
pos ("a'b'cbe","b") |
3 |
pos@q("a'b'cbe","b") |
6,使用@q选项引号内的跳过。 |