# Alphanumeric Sort

**URL:** <https://www.ruby-forum.com/t/alphanumeric-sort/144645>\
**Category:** Rails\
**Created:** [July 31, 2008, 7:10pm UTC](https://www.ruby-forum.com/t/alphanumeric-sort/144645 "2008-07-31T19:10:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tgreiser](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/258eb7/32.png) [@tgreiser](https://www.ruby-forum.com/u/tgreiser)\
**Post date:** [July 31, 2008, 7:10pm UTC](https://www.ruby-forum.com/t/alphanumeric-sort/144645/1 "2008-07-31T19:10:20Z")

</div>

On Thu, Jul 31, 2008 at 10:47 AM, Robert W.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)wrote:

> I’d say no, this sort of thing would not be useful (recommended) in core.  
> String based sorting is what it is (and is also affected by language and  
> locale).

Don’t numerals come before letters in all languages and locales?

> What you are doing is very specialized to your application.

I think it has usefulness in a number of situations. Has anyone else had  
to  
do something like this?

> three integer values in the database.  
> That would work if all of the books in the database fit that model  
> (title  
> number and parts range). Most don’t, but a decent portion do. Others use  
> volume numbers (“Vol. 1”, “Vol. 2”) or edition dates (“2008 Edition”).

The question was if there’s a more efficient way to perform the sort.  
Being  
able to have the database do the sort would be great, but the database  
(MySQL 5.1) can’t split a string and sort the resulting array.

## Thanks,

Tim
