Pos()
功能:在一个字符串中查找所包含的另一个字符串的起始位置。
语法:Pos ( string1, string2 {, start } )
参数:
string1:string类型,指定要从中查找子串string2的字符串(与pascal相反)
string2:string类型,指定要在string1中查找的字符串(与pascal相反)
start:long类型,可选项,指定从string1的第几个字符开始查找。缺省值为1返回值Long。
函数执行成功时返回在start位置后string2在string1中第一次出现的起始位置。如果在string1中按指定要求未找到string2、或start的值超过了string1的长度,那么Pos()函数返回0。如果任何参数的值为NULL,Pos()函数返回NULL。
用法Pos()函数在字符串查找时区分大小写,因此,aa不匹配AA。
pb9以下用PosW()
pb9以上用PosA()
任何版本都可以用Pos()
举例:
String ls_string ='ABC'
integer li_pos
li_pos =pos(ls_string,'B')
这是 li_pos =2
如果 li_pos = pos (ls_string,'B',3) 则 li_pos =0