Sample code for 30+ languages & platforms
Lua Requires Chilkat v9.5.0.77+

StringBuilder RemoveAfterFinal

Demonstrates the StringBuilder.RemoveAfterFinal method.

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

local sb = chilkat.StringBuilder.new()
local success = sb:append("abc::def::ghi")

-- Replace the 1st occurrence of a substring with another string.
local bFound = sb:replace_first("::", "-")

print("bFound = " .. tostring(bFound))
print("sb contains: " .. sb:get_as_string())

-- Output is:
-- bFound = True
-- sb contains: abc-def::ghi