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

StringBuilder RemoveBefore

Demonstrates the StringBuilder.RemoveBefore method.

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

local sb = chilkat.StringBuilder.new()
local success = sb:append("http://www.chilkatsoft.com")

-- The RemoveBefore method removes the chars up to and including the marker string.
-- If the marker is not found, then nothing is removed and the method returns false.
local marker = "//"
local bFound = sb:remove_before(marker)

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

-- Output is:
-- bFound = true
-- sb contains: www.chilkatsoft.com