hi,

I have problems with sorting array of strings with special characters (č
š ž),


%w"abcčdesšuvzž".sort => "abcdesuvzčšž"

the right order should be č after c, š after s and ž after z.

I write my own sort method:

sort_order = ['a','b','c','č','d','e','f','g','h','i','j','k','l',
    'm','n','o','q','p','r','s','š','t','u','v','w','z','ž','x','y']
user_items.sort_by {|u| sort_order.index(u.name.first)}

But it only works, if im sorting by first character.

How can i sort the whole words with right order?

example: %w"audi, bmw 320i, ,bmw 320d, seat, škoda, ...".


thanks

sergej
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to