withFirstLetterAsUpperCase method

String withFirstLetterAsUpperCase()

Converts the first letter of the string to uppercase.

The same as capitalize.

Implementation

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