string.countWords ("Programmers drink lots of coffee.")
» 5
string.countWords ("Frontier scripters have more fun.")
» 5
In this example, extra spaces after "have" don't count; they are still one delimiter.
string.countWords ("New-York Mets")
» 2
If the blank is still the word delimiter, the hyphen doesn't count. If the hyphen is now the word delimiter, there are still two words!
string.setWordChar(":");
string.countWords ("Hard Disk:System Folder:System")
» 3
In this example ":" is set as the wordChar. Colons are separators, so spaces don't count as word delimiters.