Lua 分割字符串
2016-11-11 17:11
337 查看
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中用Split函数分割字符串
- Lua的字符串分割函数
- Lua封装根据某种格式分割字符串
- Lua string split分割字符串
- Lua中分割字符串
- lua 分割字符串
- lua脚本中字符串分割split
- lua字符串的分割函数
- lua字符串分割 string.split实现
- Lua中通过特定字符串对目的字符串进行分割
- lua分割字符串
- lua 分割字符串
- Lua中用Split函数分割字符串
- [寒江孤叶丶的Cocos2d-x之旅_20]Lua字符串分割函数分享,Lua StringSplit
- lua中字符串的分割函数
- 0基础lua学习(二十一)分割字符串逗号
- Lua 用指定字符或字符串分割输入字符串,返回包含分割结果的数组
- Lua 分割字符串
- lua字符串分割
- Lua中用Split函数分割字符串