titleCase method

String titleCase()

Capitalizes the first character of each word.

'hello world'.titleCase() // 'Hello World'

Implementation

String titleCase() {
  if (isEmpty) return '';
  return split(' ').map((w) => w.capitalize()).join(' ');
}