capitalise static method

String capitalise(
  1. String str
)

Capitalises a string, i.e. converts the first letter to uppercase and all other letters to lowercase, e.g.:

goog.string.capitalise('one') => 'One' goog.string.capitalise('ONE') => 'One' goog.string.capitalise('one two') => 'One two'

Note that this function does not trim initial whitespace.

@param {string} str String value to capitalize. @return {string} String value with first letter in uppercase.

Implementation

static String capitalise(String str)
{
  return str[0].toUpperCase() + str.substring(1).toLowerCase();
}