(PowerShell) StringBuilder GetNth
Demonstrates the GetNth method.
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"
# The GetNth method is handy for getting parts from delimited strings.
# For example:
$sb = New-Object Chilkat.StringBuilder
$sb.Append("red,blue,`"green,purple`",,yellow")
$delimiterChar = ","
$exceptDoubleQuoted = $true
$exceptEscaped = $true
# Prints "[red]"
$("[" + $sb.GetNth(0,$delimiterChar,$exceptDoubleQuoted,$exceptEscaped) + "]")
# Prints "[blue]"
$("[" + $sb.GetNth(1,$delimiterChar,$exceptDoubleQuoted,$exceptEscaped) + "]")
# Prints "[green,purple]"
$("[" + $sb.GetNth(2,$delimiterChar,$exceptDoubleQuoted,$exceptEscaped) + "]")
# Prints "[]"
$("[" + $sb.GetNth(3,$delimiterChar,$exceptDoubleQuoted,$exceptEscaped) + "]")
# Prints "[yellow]"
$("[" + $sb.GetNth(4,$delimiterChar,$exceptDoubleQuoted,$exceptEscaped) + "]")
# Prints "[]"
$("[" + $sb.GetNth(5,$delimiterChar,$exceptDoubleQuoted,$exceptEscaped) + "]")
|