$str.word Returns the nth word in a string |
Usage |
<string> $str.word(<n:int>,<string:string>) |
Description |
Returns the nth word inside the <string> (with n starting from 0!) A word is a substring not containing spaces (ASCII chars 32, carriage returns, tabs etc.). If the string contains less than n+1 words then an empty string is returned. This function is faster than a call to $str.split() and array indexing if you need a single word to be extracted from a complex string. If you need to manage more than one word from the string then the $str.split() method is more efficient. This function is a special case of $str.token() and it runs a bit faster. |
Examples |
%test = "this is a string full of words" echo $str.word(4,%test) |
See also |
$str.token |