function findStr(m_Str)
local mStr = m_Str .. ","
local tabNum = {}check
while mStr do
local len = string.len(mStr)
local index = string.find(mStr, ",")
local findStr = string.sub( mStr, 1, index - 1 )
table.insert(tabNum, 1, findStr)
if index >= len then
mStr = nil
return tabNum
end
mStr = string.sub(mStr, index + 1, len)
end
return tabNum
end
local tableNew = findStr(" 1, 3, 4, 5, 6")
for i = 1, #tableNew do
print(tableNew[i])
end
Lua 分割字符串
最新推荐文章于 2024-06-30 22:38:07 发布