@@ -71,24 +71,35 @@ fn shift_code<F,G>(judge: F, convert: G, src: &str) -> String
7171/// Convert Wide-alphanumeric into normal ASCII [A -> A]
7272/// # Examples
7373/// ```
74- /// let s3 = "#&Rust-1.6!";
75- /// assert_eq!("#&Rust-1.6!", kana::wide2ascii(s3));
74+ /// assert_eq!("#&Rust-1.6!", kana::wide2ascii("#&Rust-1.6!"));
7675/// ```
7776pub fn wide2ascii ( s : & str ) -> String {
7877 shift_code ( |x| 0xff00 < x && x < 0xff5f , |x| x - 0xfee0 , s)
7978}
8079
8180/// Convert normal ASCII characters into Wide-alphanumeric [A -> A]
81+ /// # Examples
82+ /// ```
83+ /// assert_eq!("#&Rust-1.6!", kana::ascii2wide("#&Rust-1.6!"));
84+ /// ```
8285pub fn ascii2wide ( s : & str ) -> String {
8386 shift_code ( |x| 0x0020 < x && x < 0x007f , |x| x + 0xfee0 , s)
8487}
8588
8689/// Convert Hiragana into Katakana [あ -> ア]
90+ /// # Examples
91+ /// ```
92+ /// assert_eq!("イロハ", kana::hira2kata("いろは"));
93+ /// ```
8794pub fn hira2kata ( s : & str ) -> String {
8895 shift_code ( |x| 0x3041 < x && x < 0x3096 , |x| x + 0x0060 , s)
8996}
9097
9198/// Convert Katakana into Hiragana [ア -> あ]
99+ /// # Examples
100+ /// ```
101+ /// assert_eq!("いろは", kana::kata2hira("イロハ"));
102+ /// ```
92103pub fn kata2hira ( s : & str ) -> String {
93104 shift_code ( |x| 0x30A1 < x && x < 0x30F6 , |x| x - 0x0060 , s)
94105}
0 commit comments