to-kana

Crates.ioto-kana
lib.rsto-kana
version0.6.0
sourcesrc
created_at2019-08-13 18:45:11.591365
updated_at2019-09-16 19:44:14.091676
descriptionConverts English phonetics to Kana, And Kana to small/half-width versions
homepage
repositoryhttps://github.com/spenserblack/to-kana-rs
max_upload_size
id156538
size102,953
Spenser Black (spenserblack)

documentation

README

to-kana

Crates.io docs.rs dependency status Crates.io downloads Crates.io downloads of latest version License

GitHub Release Date GitHub commits since latest release

Converts English lettering to Kana. Please see the wiki to get supported inputs.

Basic Usage

As Library

Using to_kana!

Check out docs.rs to get all available formats for to_kana!

use to_kana::to_kana;

// こんにちは、ワールド!
let hello_world = to_kana!("{:H}{:K}", "konnichiha,", "wa-rudo!").unwrap();

// Half-width カタカナ works too!
let half = to_kana!("Half-width {:K/2} works too!", "katakana").unwrap();

The Old Ways

use to_kana::ToKana;

let hello = "konnichiha,".hira().unwrap(); // Works on &str
let world = String::from("wa-rudo!").kata().unwrap(); // And String!

println!("{}{}", hello, world)); // こんにちは、ワールド!
use to_kana::{
    hira, // Hiragana
    kata, // Katakana
};

let hello = hira("konnichiha,").unwrap();
let world = kata("wa-rudo!").unwrap();

println!("{}{}", hello, world); // こんにちは、ワールド!

What if you don't want to just convert to Kana? What if you want to convert to small, half-width Katakana? You can!

use to_kana::{
    ToKana,
    SmallKana,
    HalfWidth,
};

// Not to be confused with "ヤ", "ャ" or "ヤ"
assert_eq!("ャ", "ya".kata().small().half_width().unwrap());

From Command Line

# Install
cargo install to-kana

# Get Help
to-kana -h
to-kana hira -h
to-kana kata -h

# Convert to Hiragana
to-kana hira <STRING>

# Convert to Katakana
to-kana kata <STRING>

# Convert to small, half-width Katakana
to-kana --small kata yo --half
Commit count: 199

cargo fmt