capitalize static method

String capitalize(
  1. String value
)

Capitalizes the first letter of the given value, and converts the rest of the string to lowercase.

Example:

StringUtils.capitalize("hello"); // "Hello"

Implementation

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