Replace

Replace all spaces in a string with '%20'.
Added comments for clarity