capitalize method

String capitalize()

Implementation

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

  if (length == 1) {
    return this[0].toUpperCase();
  }

  return "${this[0].toUpperCase()}${substring(1).toLowerCase()}";
}