Sample code for 30+ languages & platforms
Go

StringBuilder GetNth

Demonstrates the GetNth method.

Chilkat Go Downloads

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

    sb := chilkat.NewStringBuilder()
    sb.Append("red,blue,\"green,purple\",,yellow")

    delimiterChar := ","
    exceptDoubleQuoted := true
    exceptEscaped := true

    // Prints "[red]"
    fmt.Println("[", *sb.GetNth(0,delimiterChar,exceptDoubleQuoted,exceptEscaped), "]")

    // Prints "[blue]"
    fmt.Println("[", *sb.GetNth(1,delimiterChar,exceptDoubleQuoted,exceptEscaped), "]")

    // Prints "[green,purple]"
    fmt.Println("[", *sb.GetNth(2,delimiterChar,exceptDoubleQuoted,exceptEscaped), "]")

    // Prints "[]"
    fmt.Println("[", *sb.GetNth(3,delimiterChar,exceptDoubleQuoted,exceptEscaped), "]")

    // Prints "[yellow]"
    fmt.Println("[", *sb.GetNth(4,delimiterChar,exceptDoubleQuoted,exceptEscaped), "]")

    // Prints "[]"
    fmt.Println("[", *sb.GetNth(5,delimiterChar,exceptDoubleQuoted,exceptEscaped), "]")

    sb.DisposeStringBuilder()