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 1 year, 10 months ago
Reputation: 1





1 Answer

0

We can do it this way.

words = params[:keyword]

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

That’s it.

answered 1 year, 10 months ago
Reputation: 1





Your Answer

Nothing to preview

Post Answer



Asked:  1 year, 10 months ago
Viewed:  365 times
Active:  1 year, 10 months ago