Lua - decodeURI (luvit)
Lua中没有一个默认方法,用于解码URI编码的字符串。在luvit中,我们可以使用querystring模块来解码URI编码的字符串。下面是一个简单的示例:
```lua
local querystring = require('querystring')
local encoded_string = 'Hello%20World%21%20How%20are%20you%3F'
local decoded_string = querystring.unescape(encoded_string)
print(decoded_string) -- 输出: Hello World! How are you?
```
在上面的示例中,我们使用querystring.unescape方法来解码URI编码的字符串。该方法将转换“%20”为“空格”,将转换“%21”为“!”等。