Old Norse alphabet constants & sort for Rust
Old Norse constains letters that may be hard to type with most keyboards. Prime examples being þ, ð and ǫ. There are also some letters "missing", like c and q. This package offers the alphabet & tricky individual letters as constants.
Also provides sorting function to get the old norse alphabet order just right.
Add this to your Cargo.toml
:
toml
[dependencies]
old_norse_alphabet = "1.0.0"
The crate offers Old Norse alphabet in lower/uppercases, and a function for sorting by old norse alphabetical order.
The crate exposes custom compare function for getting old norse alphabetical order just right.
```rust use oldnorsealphabet::oldnorsesort;
// Sample vec of old norse words. let mut words = vec!["öðli", "ógnan", "æðrask", "aðili", "þakkan", "áfir", "á-auki", "él-ligr", "maðka", "ef-lauss", "œgir", "áðr", "maðr", "madr", "mæðr"]; words.sortby(|a, b| oldnorse_sort(a, b));
// Sorted vec is: "aðili", "á-auki", "áðr", "áfir", "ef-lauss", "él-ligr", "madr", "maðka", "maðr", "mæðr", "ógnan", "þakkan", "æðrask", "œgir", "öðli" ```
To use the alphabet constants:
```rust use oldnorsealphabet::{getlowercase, getuppercase};
// Outputs are [char; 34] let lower = getlowercase(); let upper = getuppercase();
for (index, letter) in lower.iter().enumerate() { println!("{}. letter: {}", index + 1, letter) // eg. 5. letter: ð } ```
Exposed special characters:
```rust use oldnorsealphabet::{ETH, THORN, OCAUDATA, SLASHEDO, AE, OE, ASH};
println!("{}", ETH); // ð println!("{}", THORN); // þ println!("{}", OCAUDATA); // ǫ println!("{}", SLASHEDO); // ø println!("{}", AE); // æ println!("{}", OE); // œ println!("{}", ASH); // Alternative export of AE ```
Old Norse was a North Germanic language that was spoken by inhabitants of Scandinavia and their overseas settlements from about the 7th to the 15th centuries.