countWords method
Counts the number of words in the string.
Example:
print("Hello Flutter Developer".countWords()); // 3
Implementation
int countWords() {
if (validate().isEmptyOrNull) return 0;
return this!.split(RegExp('\\s+')).length;
}
Counts the number of words in the string.
Example:
print("Hello Flutter Developer".countWords()); // 3
int countWords() {
if (validate().isEmptyOrNull) return 0;
return this!.split(RegExp('\\s+')).length;
}