PureBasic
PureBasic
HTML Entity Encode and Decode in StringBuilder
Demonstrates HTML encoding and decoding the contents of a StringBuilder.Chilkat PureBasic Downloads
IncludeFile "CkStringBuilder.pb"
Procedure ChilkatExample()
sb.i = CkStringBuilder::ckCreate()
If sb.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
s.s = "< é ü ç Ω Hello & World ✓ >"
CkStringBuilder::ckAppend(sb,s)
CkStringBuilder::ckEncode(sb,"html","utf-8")
Debug CkStringBuilder::ckGetAsString(sb)
; Output:
; < é ü ç Ω Hello & World ✓ >
; To decode:
CkStringBuilder::ckDecode(sb,"html","utf-8")
Debug CkStringBuilder::ckGetAsString(sb)
; Output:
; < é ü ç Ω Hello & World ✓ >
CkStringBuilder::ckDispose(sb)
ProcedureReturn
EndProcedure