Read Me - Common Public License V1.0 - Copyright Notice(©)

caselessWordPos


>>-caselessWordPos(phrase-+--------+-)---------------------------------><
                          +-,start-+

Returns the word number of the first word of [phrase] found in the receiving string, or 0 if [phrase] contains no words or if [phrase] is not found. Word matches are made independent of case. Several whitespace characters between words in either [phrase] or the receiving string are treated as a single blank for the comparison, but, otherwise, the words must match exactly.

By default the search starts at the first word in the receiving string. You can override this by specifying [start] (which must be positive), the word at which the search is to be started.

String class - caselessWordPos method

"now is the time"~caselessWordPos("the")              ->  3
"now is the time"~caselessWordPos("The")              ->  3
"now is the time"~caselessWordPos("IS THE")           ->  2
"now is the time"~caselessWordPos("is   the")         ->  2
"now is   the time"~caselessWordPos("is   time ")     ->  0
"To be or not to be"~caselessWordPos("BE")            ->  2
"To be or not to be"~caselessWordPos("BE",3)          ->  6

Read Me - Common Public License V1.0 - Copyright Notice(©)