capitalizeFirst method

String capitalizeFirst()

Capitalizes only the first letter of the string. Example: "hello world" → "Hello world"

Implementation

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