Saturday 4 May 2013

Workaround about sorting English ordinal numbers or Roman numbers

You may want to sort texts containing English ordinal numbers or Roman numbers by their numerical order instead of dictionary order. For example

1st word
2nd word
3rd word
4th word

Richard I
Richard II
Richard III
Richard IV

One simple workaround for this is to encode them as simple numbers in the text, e.g.

#T001 word
#T002 word
#T003 word
#T004 word

Richard #R01
Richard #R02
Richard #R03
Richard #R04

then they can be sorted by dictionary order. When you need to display them, convert them to ordinal number or Roman number.

1 comment:

  1. I think other blogs owners should take this blog as an model - very clean and great style and design, not to mention the content about roman to english dictionary . You are an expert in this area!

    ReplyDelete