Sample code for 30+ languages & platforms
JavaScript

StringBuilder GetNth

Demonstrates the GetNth method.
Note
This example is intended for running within a Chilkat.Js embedded JavaScript engine. All Chilkat JavaScript examples require Chilkat v11.4.0 or greater.
JavaScript
// The GetNth method is handy for getting parts from delimited strings.
// For example:

var sb = new CkStringBuilder();
sb.Append("red,blue,\"green,purple\",,yellow");

var delimiterChar = ",";
var exceptDoubleQuoted = true;
var exceptEscaped = true;

// Prints "[red]"
console.log("[" + sb.GetNth(0,delimiterChar,exceptDoubleQuoted,exceptEscaped) + "]");

// Prints "[blue]"
console.log("[" + sb.GetNth(1,delimiterChar,exceptDoubleQuoted,exceptEscaped) + "]");

// Prints "[green,purple]"
console.log("[" + sb.GetNth(2,delimiterChar,exceptDoubleQuoted,exceptEscaped) + "]");

// Prints "[]"
console.log("[" + sb.GetNth(3,delimiterChar,exceptDoubleQuoted,exceptEscaped) + "]");

// Prints "[yellow]"
console.log("[" + sb.GetNth(4,delimiterChar,exceptDoubleQuoted,exceptEscaped) + "]");

// Prints "[]"
console.log("[" + sb.GetNth(5,delimiterChar,exceptDoubleQuoted,exceptEscaped) + "]");