Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C#: get letters of alphabet for scandinavian language?

Is there a way to get the letters of the alphabet in a language?

I want to do paging, and I want to show for example the last 7 letters of the alphabet. For the dutch alphabet t-z are the last 7 letters, but for Sweden it's w-ö (which is w x y z å ä ö).

And when I get that as input, for the "normal" a-z alphabet I can generate the letters in between by using the ASCII table, but for Sweden that won't work.

like image 553
Michel Avatar asked Oct 09 '09 09:10

Michel


2 Answers

To the best of my knowledge, neither .NET nor Windows provide this information. However, you can find it in the Unicode Consortium's CLDR database. This DB is actually a set of XML files (one for each language. named after the language abbreviation) containing all sorts of localisation info. A gold mine!

the element /ldml/characters/examplarCharacters contains a list of characters used in the language. e.g., for Swedish (sv.xml):

[a-v x-z å ä ö]

Note that when you say 'ASCII letters', you do realize you're limiting yourself to the Latin script, don't you? As far as ar the CLDR is concerned, lists such as a-z are Unicode characters sequences, not just ASCII letters. eg, in Russian (from ru.xml):

[а-е ё ж-я]
like image 58
Serge Wautier Avatar answered Nov 03 '22 16:11

Serge Wautier


I don't think it's accessible programmatically by default but here's a good set of reference documents at the Evertype website

like image 38
Lazarus Avatar answered Nov 03 '22 14:11

Lazarus