capitalize method

String capitalize()

capitalizes a given string 'hello' => 'Hello' 'Hello' => 'Hello' '' => ''

Implementation

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