(PowerBuilder) StringBuilder RemoveAfterFinal
Demonstrates the StringBuilder.RemoveAfterFinal method.
The GetBefore method was added in Chilkat v9.5.0.77
integer li_rc
oleobject loo_Sb
integer li_Success
string ls_Marker
integer li_BFound
loo_Sb = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
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
|