toFirstUpper function

String toFirstUpper (String string)

Formats a given string to used a 'sentence' format :

UPPER CASE PHRASE -> Upper case phrase lower case phrase -> Lower case phrase Mixed CASE phrase -> Mixed case phrase

Implementation

String toFirstUpper(String string) {
  return string[0].toUpperCase() + string.substring(1).toLowerCase();
}