PureBasic
PureBasic
Remove a Range of Chars from a StringBuilder
Demonstrates how to remove a range of chars from the string contained in a StringBuilder object.Note: This example demonstrates the RemoveCharsAt method which was added in Chilkat v9.5.0.87.
Chilkat PureBasic Downloads
IncludeFile "CkStringBuilder.pb"
Procedure ChilkatExample()
success.i = 0
sb.i = CkStringBuilder::ckCreate()
If sb.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; Load a file that contains this string: 0123456789ABCDEF
success = CkStringBuilder::ckLoadFile(sb,"qa_data/txt/remove_chars.txt","utf-8")
; Remove "56789A" from the string.
CkStringBuilder::ckRemoveCharsAt(sb,5,6)
Debug CkStringBuilder::ckGetAsString(sb)
; Output is: 01234BCDEF
CkStringBuilder::ckDispose(sb)
ProcedureReturn
EndProcedure