Home »
Code Examples »
Lua Code Examples
Lua - Replacing occurrences of one string with another Code Example
The code for Replacing occurrences of one string with another
str = "Hello, world - The world is mine"
-- replacing strings
result = str.gsub(str,"world","globe")
print("The new string is "..result)
--[[
Output:
The new string is Hello, globe - The globe is mine
--]]
Code by IncludeHelp,
on August 25, 2022 23:00