What I do
str= " John Smith Beer "
str.tr(" ", "%20")
"%%John%%%Smith%Beer%"
It doesn't replace it with "%20". How to fix it?
require 'uri'
URI.encode("green books")
# => "green%20books"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With