toTitleCase property

String get toTitleCase

Implementation

String get toTitleCase {
  if (this == null) return '';
  return this!.replaceAllMapped(RegExp(r"\w+"), (Match match) {
    String word = match[0]!;
    return "${word[0].toUpperCase()}${word.substring(1).toLowerCase()}";
  });
}