capitalizeEachWordFirstCharacter method

String capitalizeEachWordFirstCharacter()

Capitalizes the first letter of each word in the string.

Example:

print("hello world".capitalizeEachWordFirstCharacter()); // "Hello World"

Implementation

String capitalizeEachWordFirstCharacter() {
  if (isEmptyOrNull) return '';
  final words = this!.split(' ');
  final formatted = words.map((e) => e.capitalizeFirstCharacter).toList();
  return formatted.join(' ');
}