lua脚本的疑问

s,e=string.data("helloLuauser","Lua") print(s,e) 为什么输出是7,9????... s,e=string.data("hello Lua user","Lua") print(s,e) 为什么输出是7,9???? 展开
 我来答
matlab2000
2011-09-28 · TA获得超过2323个赞
知道大有可为答主
回答量:1678
采纳率:100%
帮助的人:1051万
展开全部
应该是find吧。另外,start,end应该是匹配的下标,lua下标从1开始
string.find (s, pattern [, init [, plain]])
Looks for the first match of pattern in the string s. If it finds a match, then find returns the indices of s where this occurrence starts and ends; otherwise, it returns nil. A third, optional numerical argument init specifies where to start the search; its default value is 1 and can be negative. A value of true as a fourth, optional argument plain turns off the pattern matching facilities, so the function does a plain "find substring" operation, with no characters in pattern being considered "magic". Note that if plain is given, then init must be given as well.
If the pattern has captures, then in a successful match the captured values are also returned, after the two indices.
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式