Sample code for 30+ languages & platforms
B4X

StringBuilder GetNth

Demonstrates the GetNth method.

Chilkat B4X Downloads

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

Dim sb As ChilkatStringBuilder
sb.Initialize
sb.Append("red,blue," & Chr(34) & "green,purple" & Chr(34) & ",,yellow")

Dim delimiterChar As String = ","
Dim exceptDoubleQuoted As Boolean = True
Dim exceptEscaped As Boolean = True

'  Prints "[red]"
Log("[" & sb.GetNth(0, delimiterChar, exceptDoubleQuoted, exceptEscaped) & "]")

'  Prints "[blue]"
Log("[" & sb.GetNth(1, delimiterChar, exceptDoubleQuoted, exceptEscaped) & "]")

'  Prints "[green,purple]"
Log("[" & sb.GetNth(2, delimiterChar, exceptDoubleQuoted, exceptEscaped) & "]")

'  Prints "[]"
Log("[" & sb.GetNth(3, delimiterChar, exceptDoubleQuoted, exceptEscaped) & "]")

'  Prints "[yellow]"
Log("[" & sb.GetNth(4, delimiterChar, exceptDoubleQuoted, exceptEscaped) & "]")

'  Prints "[]"
Log("[" & sb.GetNth(5, delimiterChar, exceptDoubleQuoted, exceptEscaped) & "]")