consonantCount method

int consonantCount()

Get the number of consonants in a string.

Implementation

int consonantCount() {
  if (this == null) {
    throw ArgumentError('string: $this');
  }
  if (this!.isEmpty) {
    return 0;
  }
  return this!.toLowerCase().split(RegExp(r'[^aeiou]')).length - 1;
}