美文网首页
lua 正则表达式

lua 正则表达式

作者: IvanRunning | 来源:发表于2018-06-21 15:28 被阅读35次
lua正则表达式元字符说明.png
-- 去掉首尾所有空格  
function trim(s)  
  return (string.gsub(s, "^%s*(.-)%s*$", "%1"))  
end  
local s = " space "  
local txt = trim(s) 
print(txt)
-- 输出 space

相关文章

网友评论

      本文标题:lua 正则表达式

      本文链接:https://www.haomeiwen.com/subject/fuzqyftx.html