(PowerBuilder) StringBuilder GetAfterBetween
Demonstrates the GetAfterBetween method.
integer li_rc
oleobject loo_Sb
string ls_SearchAfter
string ls_CompanyName
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
loo_Sb.Append("<abc><person><name>Joe</name></person><company><name>Chilkat Software</name></company></abc>")
// The GetAfterBetween method gets the substring between two arbitrary marker strings, and doesn't
// start searching until the searchAfter string is passed.
// For example, to get the company name in the string above...
ls_SearchAfter = "<company>"
ls_CompanyName = loo_Sb.GetAfterBetween(ls_SearchAfter,"<name>","</name>")
Write-Debug "Company Name = " + ls_CompanyName
destroy loo_Sb
|