(C#) StringBuilder GetNth
Demonstrates the GetNth method.
// The GetNth method is handy for getting parts from delimited strings.
// For example:
Chilkat.StringBuilder sb = new Chilkat.StringBuilder();
sb.Append("red,blue,\"green,purple\",,yellow");
string delimiterChar = ",";
bool exceptDoubleQuoted = true;
bool exceptEscaped = true;
// Prints "[red]"
Debug.WriteLine("[" + sb.GetNth(0,delimiterChar,exceptDoubleQuoted,exceptEscaped) + "]");
// Prints "[blue]"
Debug.WriteLine("[" + sb.GetNth(1,delimiterChar,exceptDoubleQuoted,exceptEscaped) + "]");
// Prints "[green,purple]"
Debug.WriteLine("[" + sb.GetNth(2,delimiterChar,exceptDoubleQuoted,exceptEscaped) + "]");
// Prints "[]"
Debug.WriteLine("[" + sb.GetNth(3,delimiterChar,exceptDoubleQuoted,exceptEscaped) + "]");
// Prints "[yellow]"
Debug.WriteLine("[" + sb.GetNth(4,delimiterChar,exceptDoubleQuoted,exceptEscaped) + "]");
// Prints "[]"
Debug.WriteLine("[" + sb.GetNth(5,delimiterChar,exceptDoubleQuoted,exceptEscaped) + "]");
|