16 lua
如何获取Lua中字符串中字符的最后一个索引?
"/some/path/to/some/file.txt"
Run Code Online (Sandbox Code Playgroud)
如何获取/上述字符串中最后一个的索引?
Amb*_*ber 23
index = string.find(your_string, "/[^/]*$")
Run Code Online (Sandbox Code Playgroud)
(基本上,找到模式"正斜杠,然后零或多个不是正斜杠的东西,然后是字符串的结尾"的位置.)