wordCount method
Get the number of words in a string.
Implementation
int wordCount() {
if (this == null) {
throw ArgumentError('string: $this');
}
if (this!.isEmpty) {
return 0;
}
return this!.split(RegExp(r'\s+')).length;
}
Get the number of words in a string.
int wordCount() {
if (this == null) {
throw ArgumentError('string: $this');
}
if (this!.isEmpty) {
return 0;
}
return this!.split(RegExp(r'\s+')).length;
}