toTitleCase method

String toTitleCase()

Converts a string to Title Case. e.g. hello world -> Hello World

Implementation

String toTitleCase() {
  if (isEmpty) {
    return this;
  }

  return split(' ').map((word) => word.toCapitalized()).join(' ');
}