(DataFlex) StringTable SplitAndAppend Example
Demonstrates the StringTable SplitAndAppend method.
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoStrTab
String s
Boolean iSuccess
Integer i
Integer iNumStrings
String sTemp1
Get Create (RefClass(cComChilkatStringTable)) To hoStrTab
If (Not(IsComObjectCreated(hoStrTab))) Begin
Send CreateComObject of hoStrTab
End
// SplitAndAppend make it easy to break apart comma delimited, semicolon delimited,
// or strings delimited by other characters.
Move 'abc,123,xyz,456,music,math,"World History","Chicago,Cubs",Japan' To s
Get ComSplitAndAppend Of hoStrTab s "," True True To iSuccess
Move 0 To i
Get ComCount Of hoStrTab To iNumStrings
While (i < iNumStrings)
Get ComStringAt Of hoStrTab i To sTemp1
Showln i ": " sTemp1
Move (i + 1) To i
Loop
// The output is:
// 0: abc
// 1: 123
// 2: xyz
// 3: 456
// 4: music
// 5: math
// 6: "World History"
// 7: "Chicago,Cubs"
// 8: Japan
// Note: Keeping the quotes is intentional.
End_Procedure
|