withCapitalizedWords method

String withCapitalizedWords()

Capitalizes each word in the string.

Implementation

String withCapitalizedWords() {
  return trim()
      .split(RegExp(r'[- ]+'))
      .map((e) => e.trim().toLowerCase().capitalize())
      .join(' ');
}