sentenceCount method

int sentenceCount()

Get the number of sentences in a string.

Implementation

int sentenceCount() {
  if (this == null) {
    throw ArgumentError('string: $this');
  }
  if (this!.isEmpty) {
    return 0;
  }
  return this!.split(RegExp(r'[.!?]+')).length;
}