(PureBasic) Load StringTable from a StringBuilder
Demonstrates how to load a StringTable from the text contained in a Chilkat StringBuilder object.
IncludeFile "CkStringBuilder.pb"
IncludeFile "CkStringTable.pb"
Procedure ChilkatExample()
strTab.i = CkStringTable::ckCreate()
If strTab.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
sb.i = CkStringBuilder::ckCreate()
If sb.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success.i
CkStringBuilder::ckAppend(sb,"This is line 1" + Chr(13) + Chr(10))
CkStringBuilder::ckAppend(sb,"An empty line follows..." + Chr(13) + Chr(10))
CkStringBuilder::ckAppend(sb,Chr(13) + Chr(10))
CkStringBuilder::ckAppend(sb,"This is line 4" + Chr(13) + Chr(10))
CkStringTable::ckAppendFromSb(strTab,sb)
i.i = 0
numStrings.i = CkStringTable::ckCount(strTab)
While i < numStrings
Debug Str(i) + ": " + CkStringTable::ckStringAt(strTab,i)
i = i + 1
Wend
CkStringTable::ckDispose(strTab)
CkStringBuilder::ckDispose(sb)
ProcedureReturn
EndProcedure
|