(PHP ActiveX) StringBuilder GetNth
Demonstrates the GetNth method.
<?php
// The GetNth method is handy for getting parts from delimited strings.
// For example:
// For versions of Chilkat < 10.0.0, use new COM('Chilkat_9_5_0.Chilkat.StringBuilder')
$sb = new COM("Chilkat.StringBuilder");
$sb->Append('red,blue,\'green,purple\',,yellow');
$delimiterChar = ',';
$exceptDoubleQuoted = 1;
$exceptEscaped = 1;
// Prints "[red]"
print '[' . $sb->getNth(0,$delimiterChar,$exceptDoubleQuoted,$exceptEscaped) . ']' . "\n";
// Prints "[blue]"
print '[' . $sb->getNth(1,$delimiterChar,$exceptDoubleQuoted,$exceptEscaped) . ']' . "\n";
// Prints "[green,purple]"
print '[' . $sb->getNth(2,$delimiterChar,$exceptDoubleQuoted,$exceptEscaped) . ']' . "\n";
// Prints "[]"
print '[' . $sb->getNth(3,$delimiterChar,$exceptDoubleQuoted,$exceptEscaped) . ']' . "\n";
// Prints "[yellow]"
print '[' . $sb->getNth(4,$delimiterChar,$exceptDoubleQuoted,$exceptEscaped) . ']' . "\n";
// Prints "[]"
print '[' . $sb->getNth(5,$delimiterChar,$exceptDoubleQuoted,$exceptEscaped) . ']' . "\n";
?>
|