Function kana_converter::to_double_byte[][src]

pub fn to_double_byte(input: &str, mode: ConvertMode) -> String

Convert a string of single-byte ASCII and half-width katakana (半角 - hankaku) characters into a string of full-width, double-byte (全角 - zenkaku) characters. The mode parameter governs whether ASCII, katakana, or both type of characters should be converted.

Example:

use kana_converter::{to_double_byte, AsciiOnly, KanaOnly, KanaAndAscii};

let half_kana = "シングルバイトカナ";
let ascii = "ASCII";
let mixed = "シングルバイトカナ ASCII ダブルバイトカナ ひらがな 漢字";

assert_eq!(to_double_byte(half_kana, KanaOnly), "シングルバイトカナ");
assert_eq!(to_double_byte(half_kana, AsciiOnly), "シングルバイトカナ");

assert_eq!(to_double_byte(ascii, AsciiOnly), "ASCII");
assert_eq!(to_double_byte(ascii, KanaOnly), "ASCII");

assert_eq!(to_double_byte(mixed, AsciiOnly), "シングルバイトカナ ASCII ダブルバイトカナ ひらがな 漢字");
assert_eq!(to_double_byte(mixed, KanaOnly), "シングルバイトカナ ASCII ダブルバイトカナ ひらがな 漢字");
assert_eq!(to_double_byte(mixed, KanaAndAscii), "シングルバイトカナ ASCII ダブルバイトカナ ひらがな 漢字");