toTitleCase function
Helper function to convert string s
to Title Case
Examples:
- hello world -> Hello World
- hello_world -> Hello_world
Implementation
String toTitleCase(String s) => s.replaceAllMapped(
RegExp('/\w\S*/g'),
(Match txt) =>
txt[0]!.toUpperCase() + txt.toString().substring(1).toLowerCase());