• Recursively removes all spaces from a given string.

    Parameters

    • s: string

      The input string from which to remove all spaces.

    Returns string

    A new string with all spaces removed.

    Example

    replaceAllSpaces("Hello World");       // "HelloWorld"
    replaceAllSpaces(" Leading spaces"); // "Leadingspaces"
    replaceAllSpaces("Trailing spaces "); // "Trailingspaces"
    replaceAllSpaces("NoSpacesHere"); // "NoSpacesHere"
    replaceAllSpaces(""); // ""