Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Replace all substring in string
function ReplaceStrInSubstrs(inputString,phr,newstr) local str = inputString local r = "" local roll = true if string.find(str,phr) then while roll do local a = string.find(str,phr) local b = a + #phr for i = 1,#str do if i >= a and i < b then r = r..newstr else r = r..str:sub(i,i) end end str = r r = "" if not string.find(str,phr) then roll = false end end end return str end print (ReplaceStrInSubstrs("Hello &World& Fuck &the& day","&","%"))
run
|
edit
|
history
|
help
0
Dirty Bag 'o Tokens Maker
String Searcher
sh
Error PCALL
cumulative probability
Goalless DRAWS
Hand positions in a circle
Lua Timer
Security keygen
dd