withFirstLetterAsUpperCase method

String withFirstLetterAsUpperCase()

Converts the first letter of the string to uppercase.

The same as capitalize.

Implementation

String withFirstLetterAsUpperCase() {
  if (isEmpty) return this;
  if (length == 1) return toUpperCase();
  return this[0].toUpperCase() + substring(1);
}