A proposal I made in a previous post, which I will still stick with for it's versitility, is to traverse the entire string:
look at first char in string
while there are more chars in the string ('\0' not encountered)
if a letter is encountered and bool wordFound is false
set bool wordFound to true
increment wordCount
else if a non-alpha char is encountered
set bool wordFound to false
look at next char in string
This algorithm will account for single spaces, double spaces, quinti-von-dipple-di-tripledy spaces (I like Dr. Suess
![[tongue] [tongue] [tongue]](/data/assets/smilies/tongue.gif)
). It will also account for smileys, oddly spaced punctuation, tabs, newlines, etc., etc..