Run Code
|
API
|
Code Wall
|
Users
|
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
Please
log in
to post a comment.
Find primes until e
test
Area of Sector Calculator
test123
Random numbers in Lua. Range: 1-49. Sets of numbers without duplicates
123
Non-Lua core for new scripting languages (Beta)
quick sort
Volume of sphere
Creating habits. Lua
Please log in to post a comment.