capitalize method

String capitalize()

Returns a new string with the first character converted to uppercase.

Implementation

String capitalize() {
  return isEmpty ? '' : this[0].toUpperCase() + substring(1);
}