There are a few hard problems in computing. Correctly handling time, naming, preventing off by one errors… sorting text may not be one of them but recently we ran into a discussion where I couldn't make up my mind anymore. Hence, this post's topic: sorting text.
How do you sort the following words:
If you'd ask ruby I'd get:
%w[cheese Ape Drums dent Beer].sort
Results in:
Which in my useless and ramshackle programmer's brain translates to, well why not, it is sorted right?
But then we moved the data into a database which was correctly set up with a proper locale for 'collation', a term that I've seen but never meant anything to me until this problem. Collation is:
> the assembly of written information into a standard order.
(thanks Wikipedia - Collation)
Databas…
Dit artikel van murblog van Maarten Brouwers (murb) is in licentie gegeven volgens een Creative Commons Naamsvermelding 3.0 Nederland licentie .