singularize static method

String singularize(
  1. String word
)

Singularize a word (basic implementation)

Implementation

static String singularize(String word) {
  if (word.endsWith('ies')) return '${word.substring(0, word.length - 3)}y';
  if (word.endsWith('es')) return word.substring(0, word.length - 2);
  if (word.endsWith('s')) return word.substring(0, word.length - 1);
  return word;
}