I am currently looking for a software/web development job preferably as a Rails-based developer.
Please email me at weston@westonganger.com. Thanks in advance for any leads!

How To Sort A String Alphabetically In Ruby

Posted by Weston Ganger

I needed to sort string alphabetically in ruby.

There is a handy chars method on string that converts a string to char array

#Case Sensitive

# Case Insensitive
str.chars.sort{|a,b| a.casecmp(b)}.join
# or

Related External Links:

Article Topic:Software Development - Rails

Date:January 23, 2016

Recommended Posts