【发布时间】:2013-07-05 12:49:26
【问题描述】:
我试图将一个字符串分成两部分,由'.' 字符分割。但是string.find() 函数无法处理
我有这种字符串
local test = "345345.57573"
我试过了
local start = string.find( test, "." )
local start = string.find( test, "\." )
local start = string.find( test, "(%w+).(%w+)" )
但他们都没有工作。 String.find() 总是返回 1 这是错误的。
可能是什么问题?
编辑:
我还尝试使用 gsub 并更改 .与另一个角色,但它也不起作用
【问题讨论】:
-
好吧,如果你只是想要两个数字,那么 a = {string.match("2353445.23434","(%w+)%.(%w+)")} 将返回一个包含数字的表格在。
标签: string lua coronasdk lua-patterns