Function camelCaseToWords

  • Converts a camelCase or PascalCase string into a space-separated, lowercase string.

    Returns

    A new string where each uppercase letter is preceded by a space and all letters are lowercase.

    Example

    camelCaseToWords('camelCaseString'); // → 'camel case string'
    camelCaseToWords('PascalCase'); // → 'pascal case'

    Remarks

    • Useful for converting identifiers into human-readable words.
    • Leading spaces are preserved if the string starts with an uppercase letter.

    Parameters

    • str: string

      The input string in camelCase or PascalCase format.

    Returns string

Generated using TypeDoc