replace_format = {/\s/ => '', /[Aa]/ => '1', /[Bb]/ => '2'} string = 'A2b31C3' for reg, s in replace_format do string.gsub!(reg, s) end
guoxiaomi 发表于 2018-4-23 16:18
用gsub,写一个for循环
replace_format = {/\s/ => '', /[Aa]/ => '1', // => '2'}
string = 'A2b31C3'
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |