local function urlEncode(s) s = string.gsub(s, "([^%w%.%- ])", function(c) return string.format("%%%02X", string.byte(c)) end) return string.gsub(s, " ", "+") end local function urlDecode(s) s = string.gsub(s, '%%(%x%x)', function(h) return string.char(tonumber(h, 16)) end) return s end print(urlDecode('muser01%40yx.com')) #结果:muser01@yx.com
转自:https://blog.csdn.net/yetyongjin/article/details/120848024
标签:function,编解码,end,string,url,lua,gsub,return From: https://www.cnblogs.com/dreamer-fish/p/17471669.html