Ad
  • Custom User Avatar

    no it works for all kinds of words. the reason it works is calling split(' ') on strings with double or arbitrarily spaced characters produced empty strings in the return value, and when you call .join() all the empty strings are joined back with spaces between them. the empty strings from splitting multi-spaced strings act as placeholders for when the string is re-formed so the spacing is preserved