toSentenceCase method
Capitalizes the first character of the string, leaving the rest as-is.
Example:
'hello'.toSentenceCase(); // 'Hello'
Implementation
String toSentenceCase() {
switch (length) {
case 0:
return this;
case 1:
return toUpperCase();
default:
return substring(0, 1).toUpperCase() + substring(1);
}
}