Questions

Split the strings seprated by space and join all again using some other delimiter in ruby

0

I am getting the strings like “abc def xyz” space seperated. I want to split and join them using the delimiter “%20”.



asked 2 years, 1 month ago
Reputation: 1





1 Answer

0

We can do it this way.

words = params[:keyword]

answer = words.split(" ").join("%20")

That’s it.

answered 2 years, 1 month ago
Reputation: 1





Your Answer

Nothing to preview

Post Answer



Asked:  2 years, 1 month ago
Viewed:  408 times
Active:  2 years, 1 month ago