capitalizeAllWords property

String? capitalizeAllWords

Capitalize all words from the String

Implementation

String? get capitalizeAllWords {
  if (isNotNullOrEmpty) {
    var input = toLowerCase();
    var words = input.split(' ');
    var capitalized = words.map((word) {
      if (word.isEmpty) {
        return '';
      }
      return word[0].toUpperCase() + word.substring(1);
    }).join(' ');
    return capitalized;
  } else {
    return null;
  }
}