Sort on a string that may contain a number

The Alphanum Algorithm

From the website

“People sort strings with numbers differently than software. Most sorting algorithms compare ASCII values, which produces an ordering that is inconsistent with human logic. Here’s how to fix it.”

Edit: Here’s a link to the Java Comparator Implementation from that site.

Leave a Comment