(PowerBuilder) StringBuilder RemoveBefore
Demonstrates the StringBuilder.RemoveBefore 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("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
|