Function count_words (o2scl)¶
-
size_t o2scl::count_words(std::string str)¶
Count the number of words in the string
str
.Words are defined as groups of characters separated by whitespace, where whitespace is any combination of adjacent spaces, tabs, carriage returns, etc. On most systems, whitespace is usually defined as any character corresponding to the integers 9 (horizontal tab), 10 (line feed), 11 (vertical tab), 12 (form feed), 13 (carriage return), and 32 (space bar). The test program
misc_ts
enumerates the characters between 0 and 255 (inclusive) that count as whitespace for this purpose.- Idea for Future:
Make consistent with split_string().