• Capitalizes the first letter of a string.

    ✅ Works in Node.js, React, and React Native.

    Parameters

    • str: string

      The input string to capitalize

    Returns string

    A new string with the first letter capitalized

    Example

    capitalize("hello world") // "Hello world"
    capitalize("WORLD") // "WORLD"
    capitalize("") // ""

Generated using TypeDoc