Sample code for 30+ languages & platforms
PowerBuilder

StringBuilder RemoveAfterFinal

Demonstrates the StringBuilder.RemoveAfterFinal 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("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 0.
ls_Marker = "::"
li_BFound = loo_Sb.RemoveAfterFinal(ls_Marker)

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

// Output is:
// bFound = 1
// sb contains: abc::def


destroy loo_Sb