Ad
  • Custom User Avatar

    how does this account for double spaces? I had to write a much longer script to account for them, this is a much more elegant solution but could you explain how it works around spaces?

    Edit: Nevermind, I see it now. When splitting the string, any double spaces "seperate" an empty string that's included inside the list, so the double spacing is restored because when joining the list, a space is put in between the word and empty string, and again between the empty string and the next word.

  • Custom User Avatar

    I really like this code - it's helped me to understand the solution - it's really clear for a beginner like me - thank you!