lua 分割字符串
来源:互联网 发布:网络保险中介会倒闭吗 编辑:程序博客网 时间:2024/06/05 04:36
转自 :http://zhaiku.blog.51cto.com/2489043/1163077
string.split = function(s, p) local rt= {} string.gsub(s, '[^'..p..']+', function(w) table.insert(rt, w) end ) return rtend
使用例子一
local str = 'abc,123,hello,ok'local list = string.split(str, ',')for _, s in ipairs(list) do print(s)end
结果:
abc123hellook
使用例子二
local str = 'abc \n123 \t hello ok'local list = string.split(str, '%s')for _, s in ipairs(list) do print(s)end
结果:
abc123hellook
阅读全文
0 0
- lua字符串分割函数
- lua 字符串分割函数
- [Lua] 字符串分割
- lua string 分割字符串
- lua字符串分割
- lua 分割字符串
- lua字符串分割
- Lua 分割字符串
- lua 分割字符串
- Lua的字符串分割函数
- Lua string split分割字符串
- Lua的字符串分割函数
- lua字符串的分割函数
- Lua中用Split函数分割字符串
- Lua中用Split函数分割字符串
- lua学习笔记14:字符串分割
- lua字符串分割 string.split实现
- LUA字符串分割方法性能比较
- 腾讯云对象存储如何在浏览器打开已上传文件
- 第六章 idea配置svn
- ios 代码耗时统计
- apache-tomcat 9 SSL证书布置及强制https
- 2017-9-28离线赛总结
- lua 分割字符串
- bootstrap Maximum call stack size exceeded
- comma.ai的数据集下载不了
- 解决友盟推送(U-Push)的register不成功,返回错误信息s=-11,s1=accs bindapp error
- Android open source TextView中的文本自动对齐
- Qt+VS "ErrorC1083Cannot open source file: 'GeneratedFiles\Debug\moc_xxx"
- poj 2386 lake counting
- 单机环境搭建kafka
- Fiddle使用