【发布时间】:2021-06-27 20:30:53
【问题描述】:
如果我有这样的字符串。
local string = "D:/Test/Stuff/Server/resources/[Test]/SuperTest"
如何删除“服务器”一词后的所有内容,使其最终看起来像这样
local string = "D:/Test/Stuff/Server"
【问题讨论】:
-
基本上,here it is。
-
print(("D:/Test/Shit/Server/resources/[Test]/SuperTest"):match("(.*Server)")) -
并且
do local string=("D:/Test/Shit/Server/resources/[Test]/SuperTest"):match("(.*Server)"):gsub('/','\\') print(string) end将其更正为反斜杠;-)
标签: lua lua-patterns