syllableCount method

int syllableCount()

Get the number of syllables in a string.

Implementation

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