Git Product home page Git Product logo

old-norse-alphabet-rs's Introduction

Old Norse Alphabet

Old Norse alphabet constants & sort for Rust

Motivation

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.

Install

Add this to your Cargo.toml:

[dependencies]
old_norse_alphabet = "1.0.0"

Usage

The crate offers Old Norse alphabet in lower/uppercases, and a function for sorting by old norse alphabetical order.

Sort

The crate exposes custom compare function for getting old norse alphabetical order just right.

use old_norse_alphabet::old_norse_sort;

// 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.sort_by(|a, b| old_norse_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"

Alphabet

To use the alphabet constants:

use old_norse_alphabet::{get_lowercase, get_uppercase};

// Outputs are [char; 34]
let lower = get_lowercase();
let upper = get_uppercase();

for (index, letter) in lower.iter().enumerate() {
    println!("{}. letter: {}", index + 1, letter) // eg. 5. letter: ð
}

Exposed special characters:

use old_norse_alphabet::{ETH, THORN, O_CAUDATA, SLASHED_O, AE, OE, ASH};

println!("{}", ETH); // ð
println!("{}", THORN); // þ
println!("{}", O_CAUDATA); // ǫ
println!("{}", SLASHED_O); // ø
println!("{}", AE); // æ
println!("{}", OE); // œ
println!("{}", ASH); // Alternative export of AE

About Old Norse

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.

old-norse-alphabet-rs's People

Contributors

dependabot[bot] avatar stscoundrel avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.