最近在编写一些bat工具时,发现自己对lua的io和正则表达式使用没什么了解,网络上转载解决问题后的文章。
函数原型 string.gsub(s, pat, repl [, n])就是 global 全局替换子字符串的意思s: 源字符串pat: 即 pattern, 匹配模式repl: replacement, 将 pat 匹配到的字串替换为 repl[, n]: 可选, 表示只看源字符串的前 n 个字符比如写一个 trim 函数:[plain] view
转载
2017-08-31 14:18:27 ·
1125 阅读 ·
0 评论