PowerBuilder
PowerBuilder
StringBuilder RemoveAfterFinal
Demonstrates the StringBuilder.RemoveAfterFinal method.The GetBefore method was added in Chilkat v9.5.0.77
Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Sb
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")
// Replace the 1st occurrence of a substring with another string.
li_BFound = loo_Sb.ReplaceFirst("::","-")
Write-Debug "bFound = " + string(li_BFound)
Write-Debug "sb contains: " + loo_Sb.GetAsString()
// Output is:
// bFound = True
// sb contains: abc-def::gh
destroy loo_Sb