(PowerBuilder) StringBuilder GetEncoded
Demonstrates the Chilkat StringBuilder GetEncoded method.
integer li_rc
string s
oleobject loo_Sb
s = "The quick brown fox jumps over the lazy dog"
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(s)
// output: The quick brown fox jumps over the lazy dog
Write-Debug loo_Sb.GetAsString()
// Get the string encoded to base64, without changing the contents of sb.
// output: VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==
Write-Debug loo_Sb.GetEncoded("base64","utf-8")
// The contents of sb are not changed..
// output: The quick brown fox jumps over the lazy dog
Write-Debug loo_Sb.GetAsString()
destroy loo_Sb
|