Reverse Ruby String Words
In my last post, i gave a simple snippet to reverse ruby string. Here, I am giving simple snippet to reverse ruby string words. So, given string like “ruby on rails”, the output going to be “rails on ruby”.
In my last post, i gave a simple snippet to reverse ruby string. Here, I am giving simple snippet to reverse ruby string words. So, given string like “ruby on rails”, the output going to be “rails on ruby”.
RSS feed for comments on this post · TrackBack URI
Piers Cawley said,
May 8, 2007 @ 8:35 am
There’s not much point in using reverse! on a temporary array.
Personallly I lead towards a slightly more golfy:
puts s.split(/(\s+)/).reverse.to_sadmin said,
May 8, 2007 @ 9:52 am
Good point. Thanks for leaving comment!
tramadol hydrocodone said,
December 2, 2007 @ 10:46 am
hydrocodone what erowid hydrocodone