(PowerBuilder) Load StringTable from a StringBuilder
Demonstrates how to load a StringTable from the text contained in a Chilkat StringBuilder object.
integer li_rc
oleobject loo_StrTab
oleobject loo_Sb
integer li_Success
integer i
integer li_NumStrings
loo_StrTab = create oleobject
// Use "Chilkat_9_5_0.StringTable" for versions of Chilkat < 10.0.0
li_rc = loo_StrTab.ConnectToNewObject("Chilkat.StringTable")
if li_rc < 0 then
destroy loo_StrTab
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Sb = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_Sb.ConnectToNewObject("Chilkat.StringBuilder")
loo_Sb.Append("This is line 1~r~n")
loo_Sb.Append("An empty line follows...~r~n")
loo_Sb.Append("~r~n")
loo_Sb.Append("This is line 4~r~n")
loo_StrTab.AppendFromSb(loo_Sb)
i = 0
li_NumStrings = loo_StrTab.Count
do while i < li_NumStrings
Write-Debug string(i) + ": " + loo_StrTab.StringAt(i)
i = i + 1
loop
destroy loo_StrTab
destroy loo_Sb
|