Return the number of words in a given string

string:get_word_count(STRING $string) : INT

string:get_word_count('foo bar')
#=> 2

string:get_word_count('foo.bar')
#=> 2

string:get_word_count('foo  ')
#=> 1

string:get_word_count('foo  .')
#=> 1

Copyright ©2013-2022 SunSed®. All rights reserved.