【发布时间】:2021-08-08 01:08:13
【问题描述】:
我正在制作一个能正确识别用户性别的程序。所以它应该将he 的每个实例替换为she,反之亦然。
问题是这也将替换 he 内部单词,例如 them、their、help...
这就是我卡住的地方。
local str = "the he he's hell"
str = str:gsub("he", "she") --tried my best, not the correct solution!
print(str) --expecting "the she she's hell"
基本上将所有he替换为she。
【问题讨论】:
标签: lua lua-patterns