capitalize static method

String capitalize(
  1. String text
)

Capitalizes the first letter of a string.

Example:

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

Implementation

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