这阵子在学习lua,今天看到string操作,书中描述string.gsub(sourceString, pattern, replacementString)返回一个字符串,但是我在实际操作中却发现,这个函数其实返回的是两部分内容,一部分是替换后的字符串,一部分是替换长度. myString = "my name is lucy, my phone numbre is 010-88993366." print(string.gsub(myString, "%d",…
今天在学习lua,熟悉项目代码的过程中,发现string.gsub好高级,所以在此mark下. 以下是lua5.1的官方文档介绍. string.gsub (s, pattern, repl [, n]) Returns a copy of s in which all occurrences of the pattern have been replaced by a replacement string specified by repl, which may be a string, a…