titleCase method
Converts the string to title case, capitalizing the first letter and lowercasing the rest.
If the string is empty, it returns an empty string.
Returns: A new string in title case, or an empty string if the original string is empty.
Example:
'mIxEd cAsE'.titleCase(); // Returns 'Mixed case'
'TITLE CASE'.titleCase(); // Returns 'Title case'
''.titleCase(); // Returns ''
Implementation
String titleCase() => isEmpty ? '' : this[0].toUpperCase() + substring(1).toLowerCase();