How can I replace the following: "[Test1][Test2][Test3]"
"[Test1][Test2][Test3]"
Here’s the catch, the string could be just [Test1][Test3] at times or even nothing How can I accomplish replacing them with the correct replacement?
[Test1][Test3]
use string.gsub for that string | Roblox Creator Documentation
local String = "[Test1][Test2][Test3]" local Replacements = { ["Test1"] = "Cat", ["Test2"] = "Dog", ["Test3"] = "Cow" } for i,v in pairs(Replacements) do String = string.gsub(String, i, v) end print(String) -->> [Cat][Dog][Cow]
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.