Skip to content

Rust implementation of a fast converter between Japanese hankaku and zenkaku characters, mojimoji.

License

Notifications You must be signed in to change notification settings

europeanplaice/mojimoji-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mojimoji-rs

Rust implementation of a fast converter between Japanese hankaku and zenkaku characters, mojimoji.

Installation

In Cargo.toml,

[dependencies]  
mojimoji-rs = "0.1.1"

Zenkaku to Hankaku

Definition

pub fn zen_to_han(text: String, ascii: bool, digit: bool, kana: bool) -> String

Arguments

  • text - text to convert.
  • ascii - indicates whether to convert ascii characters.
  • digit - indicates whether to convert digits.
  • kana - indicates whether to convert Japanese characters.

Examples

use mojimoji_rs::zen_to_han;
assert_eq!(zen_to_han("アイウabc012".to_string(), true, true, true), "アイウabc012".to_string());
assert_eq!(zen_to_han("アイウabc012".to_string(), true, true, false), "アイウabc012".to_string());
assert_eq!(zen_to_han("アイウabc012".to_string(), true, false, true), "アイウabc012".to_string());
assert_eq!(zen_to_han("アイウabc012".to_string(), false, true, true), "アイウabc012".to_string());

Hankaku to Zenkaku

Definition

pub fn han_to_zen(text: String, ascii: bool, digit: bool, kana: bool) -> String

Arguments

  • text - text to convert.
  • ascii - indicates whether to convert ascii characters.
  • digit - indicates whether to convert digits.
  • kana - indicates whether to convert Japanese characters.

Examples

use mojimoji_rs::han_to_zen;
assert_eq!(han_to_zen("アイウabc012".to_string(), true, true, true), "アイウabc012".to_string());
assert_eq!(han_to_zen("アイウabc012".to_string(), true, true, false), "アイウabc012".to_string());
assert_eq!(han_to_zen("アイウabc012".to_string(), true, false, true), "アイウabc012".to_string());
assert_eq!(han_to_zen("アイウabc012".to_string(), false, true, true), "アイウabc012".to_string());

About

Rust implementation of a fast converter between Japanese hankaku and zenkaku characters, mojimoji.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages