toTitleCase function

String toTitleCase(
  1. String text
)

Converts the first character of a given string to uppercase.

This function takes a text string and returns a new string where the first character is converted to uppercase, and the rest of the string remains unchanged.

Returns the string with its first character in uppercase.

Implementation

String toTitleCase(String text) {
  return text[0].toUpperCase() + text.substring(1);
}