wana_kana 5.0.0

Utility library for checking and converting between Japanese characters - Kanji, Hiragana, Katakana - and Romaji
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::constants::{HALFWIDTH_PROLONGED_SOUND_MARK, PROLONGED_SOUND_MARK};

/// Returns true if char is the prolonged sound mark (fullwidth 'ー' or halfwidth 'ー').
pub fn is_prolonged_sound(char: char) -> bool {
    let code = char as u32;
    code == PROLONGED_SOUND_MARK || code == HALFWIDTH_PROLONGED_SOUND_MARK
}

#[test]
fn is_prolonged_sound_test() {
    assert!(is_prolonged_sound(''));
    assert!(is_prolonged_sound(''));
    assert!(!is_prolonged_sound('-'));
    assert!(!is_prolonged_sound('f'));
    assert!(!is_prolonged_sound(''));
}