capitalize method

String capitalize()

Returns a new string with the first character in upper case.

'hello'.capitalize() // 'Hello'

Implementation

String capitalize() {
  if (isEmpty) return '';
  return '${this[0].toUpperCase()}${substring(1)}';
}