toTitleCase method

String toTitleCase()

Implementation

String toTitleCase() {
  return replaceAll(RegExp(' +'), ' ')
      .split(' ')
      .map((str) => str.isEmpty ? str : '${str[0].toUpperCase()}${str.substring(1).toLowerCase()}')
      .join(' ');
}