firstToUpper method

String firstToUpper()

Converts first character in this string to upper case.

If the first character of the string is already in upper case, this method returns this.

Example:

'alphabet'.firstToUpper(); // 'Alphabet'
'ABC'.firstToUpper();      // 'ABC

This function uses toUpperCase(), that uses the language independent Unicode mapping and thus only works in some languages.

Implementation

String firstToUpper() =>
    isNotEmpty ? '${this[0].toUpperCase()}${substring(1)}' : this;