Crates.io | to-kana |
lib.rs | to-kana |
version | 0.6.0 |
source | src |
created_at | 2019-08-13 18:45:11.591365 |
updated_at | 2019-09-16 19:44:14.091676 |
description | Converts English phonetics to Kana, And Kana to small/half-width versions |
homepage | |
repository | https://github.com/spenserblack/to-kana-rs |
max_upload_size | |
id | 156538 |
size | 102,953 |
Converts English lettering to Kana. Please see the wiki to get supported inputs.
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();
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());
# 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