Sample code for 30+ languages & platforms
Node.js

StringBuilder GetNth

Demonstrates the GetNth method.

Chilkat Node.js Downloads

Node.js
NODEJS_PRELUDE

function chilkatExample() {

    //  The GetNth method is handy for getting parts from delimited strings.
    //  For example:

    var sb = new chilkat.StringBuilder();
    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) + "]");

}

chilkatExample();