Sample code for 30+ languages & platforms
PowerBuilder

StringBuilder RemoveBefore

Demonstrates the StringBuilder.RemoveBefore method.

The GetBefore method was added in Chilkat v9.5.0.77

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Sb
string ls_Marker
integer li_BFound

li_Success = 0

loo_Sb = create oleobject
li_rc = loo_Sb.ConnectToNewObject("Chilkat.StringBuilder")
if li_rc < 0 then
    destroy loo_Sb
    MessageBox("Error","Connecting to COM object failed")
    return
end if
li_Success = loo_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 0.
ls_Marker = "//"
li_BFound = loo_Sb.RemoveBefore(ls_Marker)

Write-Debug "bFound = " + string(li_BFound)
Write-Debug "sb contains: " + loo_Sb.GetAsString()

// Output is:
// bFound = 1
// sb contains: www.chilkatsoft.com


destroy loo_Sb