Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Sorting an array in a natural way
Ruby

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
README.markdown
Rakefile
naturalsorter.gemspec

README.markdown

NaturalSorter

This open source project is sorting arrays in a natural way. Assume you have an string array like this here

["init30", "init20", "init200"]

If you are sorting this in ruby with ".sort" you will get this result

["init20", "init200", "init30"]

Because the default sort method does not recognize the numbers in the string. The NaturalSorter will return this result.

["init20", "init30", "init200"]

Something went wrong with that request. Please try again.