Strings In Depth13 / 14
Up next

Replace with gsub

-- gsub returns the new string and the number of replacements
local s = "one two two three"
local result, count = string.gsub(s, "two", "2")
print(result)
print(count)
What you're solving

string.gsub replaces all matches