Function capitalize

Capitalize the first letter of a string.

capitalize("hello") // "Hello"
capitalize("hello my Friend", true) // "Hello my friend"
capitalize("hello my Friend", false) // "Hello my Friend"
  • Parameters

    • text: string

      source string

    • OptionalrestLowercase: boolean = false

      should the rest of the string be forced to lowercase?

    Returns string