Lua Requires Chilkat v9.5.0.77+
Lua
StringBuilder RemoveAfterFinal
Demonstrates the StringBuilder.RemoveAfterFinal method.Chilkat Lua Downloads
local chilkat = require("chilkat")
local sb = chilkat.StringBuilder.new()
local success = sb:append("abc::def::ghi")
-- The RemoveAfterFinal method removes the chars after the final occurrence of the marker.
-- It also removes the marker string.
-- If the marker is not found, then nothing is removed and the method returns false.
local marker = "::"
local bFound = sb:remove_after_final(marker)
print("bFound = " .. tostring(bFound))
print("sb contains: " .. sb:get_as_string())
-- Output is:
-- bFound = true
-- sb contains: abc::def