Inverse a string based on a delimiter


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. class String
  2.  
  3. # Reverses a string based on a delimiter
  4. def inverse(delim=",")
  5. self.split(",").reverse.join(", ")
  6. end
  7. end

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.