Lua
Lua
StringBuilder ReplaceWord
Demonstrates the ReplaceWord method.Chilkat Lua Downloads
local chilkat = require("chilkat")
local sb = chilkat.StringBuilder.new()
sb:append("forest, lumber, lumberjack, jack, timberland")
-- The ReplaceWord method replaces word occurances.
-- For example:
local numReplacements = sb:replace_word("lumber", "timber")
numReplacements = sb:replace_word("jack", "joe")
-- The string content is now:
-- forest, timber, lumberjack, joe, timberland
print(sb:get_as_string())