@@ -71,24 +71,35 @@ fn shift_code<F,G>(judge: F, convert: G, src: &str) -> String
71
71
/// Convert Wide-alphanumeric into normal ASCII [A -> A]
72
72
/// # Examples
73
73
/// ```
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!"));
76
75
/// ```
77
76
pub fn wide2ascii ( s : & str ) ->String {
78
77
shift_code ( |x|0xff00 < x && x <0xff5f , |x| x -0xfee0 , s)
79
78
}
80
79
81
80
/// Convert normal ASCII characters into Wide-alphanumeric [A -> A]
81
+ /// # Examples
82
+ /// ```
83
+ /// assert_eq!("#&Rust-1.6!", kana::ascii2wide("#&Rust-1.6!"));
84
+ /// ```
82
85
pub fn ascii2wide ( s : & str ) ->String {
83
86
shift_code ( |x|0x0020 < x && x <0x007f , |x| x +0xfee0 , s)
84
87
}
85
88
86
89
/// Convert Hiragana into Katakana [あ -> ア]
90
+ /// # Examples
91
+ /// ```
92
+ /// assert_eq!("イロハ", kana::hira2kata("いろは"));
93
+ /// ```
87
94
pub fn hira2kata ( s : & str ) ->String {
88
95
shift_code ( |x|0x3041 < x && x <0x3096 , |x| x +0x0060 , s)
89
96
}
90
97
91
98
/// Convert Katakana into Hiragana [ア -> あ]
99
+ /// # Examples
100
+ /// ```
101
+ /// assert_eq!("いろは", kana::kata2hira("イロハ"));
102
+ /// ```
92
103
pub fn kata2hira ( s : & str ) ->String {
93
104
shift_code ( |x|0x30A1 < x && x <0x30F6 , |x| x -0x0060 , s)
94
105
}