toCapitalized method

String toCapitalized()

Capitalizes the first letter of the string.

Implementation

String toCapitalized() {
  if (isEmpty) {
    return this;
  }

  return this[0].toUpperCase() + (length > 1 ? substring(1) : '');
}