VFP上的AT()函数是怎么用的,最好用例题讲

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/08 20:59:18
VFP上的AT()函数是怎么用的,最好用例题讲

VFP上的AT()函数是怎么用的,最好用例题讲
VFP上的AT()函数是怎么用的,最好用例题讲

VFP上的AT()函数是怎么用的,最好用例题讲
STORE "NOW is the time for all good men" TO gcString && 这时候 gcString = "NOW is the time for all good men"
STORE "is the" TO gcFindString && 这时候 gcFindString = "is the"
AT (gcFindString,gcString) && 在 "NOW is the time for all good men" 寻找 "is the" 的开始位置,返回 5
STORE "IS" TO gcString && 这时候 gcString = "IS"
AT(gcFindString,gcString) && && 在 "IS" 寻找 "is the" 的开始位置,返回 0

求一个子串在另一个字符串中的起始位置。
如AT('abcdef','c')=3

格式:at(串1,串2,)
功能:查找串1在串2中第n次出现的位置。若n省略,默认n=1.
例如:
?at("is","This is a book")
3
?at("is","This is a book",2)
6
?at("is","This is a book",3)
0