(Unicode C++) StringBuilder GetNth
Demonstrates the GetNth method.
#include <CkStringBuilderW.h>
void ChilkatSample(void)
{
// The GetNth method is handy for getting parts from delimited strings.
// For example:
CkStringBuilderW sb;
sb.Append(L"red,blue,\"green,purple\",,yellow");
const wchar_t *delimiterChar = L",";
bool exceptDoubleQuoted = true;
bool exceptEscaped = true;
// Prints "[red]"
wprintf(L"[%s]\n",sb.getNth(0,delimiterChar,exceptDoubleQuoted,exceptEscaped));
// Prints "[blue]"
wprintf(L"[%s]\n",sb.getNth(1,delimiterChar,exceptDoubleQuoted,exceptEscaped));
// Prints "[green,purple]"
wprintf(L"[%s]\n",sb.getNth(2,delimiterChar,exceptDoubleQuoted,exceptEscaped));
// Prints "[]"
wprintf(L"[%s]\n",sb.getNth(3,delimiterChar,exceptDoubleQuoted,exceptEscaped));
// Prints "[yellow]"
wprintf(L"[%s]\n",sb.getNth(4,delimiterChar,exceptDoubleQuoted,exceptEscaped));
// Prints "[]"
wprintf(L"[%s]\n",sb.getNth(5,delimiterChar,exceptDoubleQuoted,exceptEscaped));
}
|