toCamelCase method

String toCamelCase()

Converts the string to camel case.

Capitalizes the first letter and converts the rest to lowercase.

Example:

'hello'.toCamelCase(); // returns 'Hello'

Implementation

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