POS()的PB中的pos()函数

如题所述

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

温馨提示:答案为网友推荐,仅供参考
第1个回答  2021-12-07
Pos()功 能:在一个字符串中查找所包含的另一个字符串的起始位置。
语 法:
Pos ( string1, string2)
参 数:
string1:string类型,指定要在string2中查找的字符串(子串);
string2:string类型, 指定要从中查找子串string1的字符串(母串);
注 意:Pos()函数在字符串查找时区分大小写例如,aa"不匹配"AA"。
*Pos()函数效率较低,一般使用KMP算法优化,但在处理随机数据时效果较好。功能:在一个字符串中查找所包含的另一个字符串的起始位置。
语法: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"
相似回答