capitalize static method

String capitalize(
  1. String text
)

Capitalize first letter of a string

Example:

FSUtils.capitalize('hello world'); // 'Hello world'

Implementation

static String capitalize(String text) {
  if (text.isEmpty) return text;
  if (text.length == 1) return text.toUpperCase();
  return text[0].toUpperCase() + text.substring(1).toLowerCase();
}