Lua 从全路径中获得文件名的方法(Linux Win)

fn_flag = string.find(filename, "\\")
 
if fn_flag then
 
dest_filename = string.match(filename, ".+\\([^\\]*%.%w+)$")
end
 
 
 
fn_flag = string.find(filename, "/")
 
if fn_flag then
 
dest_filename = string.match(filename, ".+/([^/]*%.%w+)$")

posted @ 2018-03-31 16:00  江上客·无类  阅读(617)  评论(0)    收藏  举报