toTitleCase method

String toTitleCase()

Title Case a String

E.g. "hello world" will become "Hello World"

Implementation

String toTitleCase() => this
    .replaceAll(RegExp(' +'), ' ')
    .split(" ")
    .map((str) => str.toCapitalized())
    .join(" ");