isVowel method

bool isVowel()

Returns true if this single-character string is a vowel.

Implementation

bool isVowel() {
  if (isEmpty || length != 1) return false;
  switch (toLowerCase()) {
    case 'a':
    case 'e':
    case 'i':
    case 'o':
    case 'u':
      return true;
    default:
      return false;
  }
}