capitalize method

String capitalize()

Capitalizes the first letter of this string

Example:

print('hello world'.capitalize()); // "Hello world"

Implementation

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