(C) Load StringTable from a StringBuilder
Demonstrates how to load a StringTable from the text contained in a Chilkat StringBuilder object.
#include <C_CkStringTable.h>
#include <C_CkStringBuilder.h>
void ChilkatSample(void)
{
HCkStringTable strTab;
HCkStringBuilder sb;
BOOL success;
int i;
int numStrings;
strTab = CkStringTable_Create();
sb = CkStringBuilder_Create();
CkStringBuilder_Append(sb,"This is line 1\r\n");
CkStringBuilder_Append(sb,"An empty line follows...\r\n");
CkStringBuilder_Append(sb,"\r\n");
CkStringBuilder_Append(sb,"This is line 4\r\n");
CkStringTable_AppendFromSb(strTab,sb);
i = 0;
numStrings = CkStringTable_getCount(strTab);
while (i < numStrings) {
printf("%d: %s\n",i,CkStringTable_stringAt(strTab,i));
i = i + 1;
}
CkStringTable_Dispose(strTab);
CkStringBuilder_Dispose(sb);
}
|