3

Preferably after ⅻⅰ/13? So it goes in "alphabetical" order.

2
  • 7
    Don't use ⅻⅰ (SMALL ROMAN NUMERAL TWELVE + SMALL ROMAN NUMERAL ONE), use ⅹⅲ (SMALL ROMAN NUMERAL TEN + SMALL ROMAN NUMERAL THREE), and ⅹⅳ (SMALL ROMAN NUMERAL TEN + SMALL ROMAN NUMERAL FOUR) will sort correctly after it. ⅺ and ⅻ as single characters are (I would guess) just for clocks.
    – Cairnarvon
    Feb 22 at 3:35
  • 5
    @Cairnarvon That would make a good answer!
    – Draconis
    Feb 22 at 3:45

1 Answer 1

4

I think what you're asking is more of an IT question than an actual Roman numeral question (that is, you don't need me to tell you 14 is XIV); let me know if I'm wrong.

Unicode does include codepoints for upper- and lowercase Roman numerals, but you very likely don't want to use them—they're included for compatibility with East Asian standards (i.e. so that VII, for example, can appear as a single character in vertical text) and for certain niche applications. This is also why U+216A ROMAN NUMERAL ELEVEN and U+216B ROMAN NUMERAL TWELVE (and the lowercase equivalents) exist as separate codepoints: some date formats use Roman numerals for the months, but may expect single characters for that.
In general, best practice is to use normal Latin letters to compose Roman numerals—VI (U+0056 LATIN CAPITAL LETTER V, U+0049 LATIN CAPITAL LETTER I) instead of Ⅵ (U+2165 ROMAN NUMERAL SIX), &c.

If you definitely do want to write composite Roman numerals using the Roman numeral codepoints, the sensible way to write numbers in the teens would be to ignore that single-character XI and XII exist altogether: if you write xiii as ⅹⅲ (U+2179 SMALL ROMAN NUMERAL TEN, U+2172 SMALL ROMAN NUMERAL THREE) and not, as you did, ⅻⅰ (U+217B SMALL ROMAN NUMERAL TWELVE, U+2170 SMALL ROMAN NUMERAL ONE), it will automatically sort correctly between ⅹⅱ (U+2179 SMALL ROMAN NUMERAL TEN, U+2171 SMALL ROMAN NUMERAL TWO) and ⅹⅳ (U+2179 SMALL ROMAN NUMERAL TEN, U+2173 SMALL ROMAN NUMERAL FOUR).
Note, however, that this system will still break down past 49: ⅹⅽ (U+2179 SMALL ROMAN NUMERAL TEN, U+217D SMALL ROMAN NUMERAL ONE HUNDRED; i.e. 90) through ⅹⅽⅸ (99) will sort before ⅼ (U+217C SMALL ROMAN NUMERAL FIFTY), and likewise ⅽⅿ (900) before ⅾ (500) and so on.

There is no trivial way around this. You'll have to store a separate numerical index with your Roman numerals and use that for sorting instead, or use regular integers internally and only convert to Roman numerals when it's time to display them, or sort by something else entirely (if this is for file names, maybe sort by modification time instead)—what, if anything, is possible will depend on your specific application.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.