[−][src]Function josa::select
pub fn select(noun: &str, josa: Josa) -> Result<&'static str>
Select appropriate josa for a string.
It is useful when you are trying to append a josa to formatted text such as <span>고양이</span>
.
If you try to append a josa to <span>고양이</span>
, it results in Error
because of the last character >
.
With this method, you can first get an appropriate josa, and then format the text with the that:
use josa::select; use josa::IGa; let cat = "고양이"; let josa = select(cat, IGa)?; let cat = format!(r#"<span class="bold">{}</span>{}"#, cat, josa); assert_eq!(cat, r#"<span class="bold">고양이</span>가"#);
Errors
If given String is an empty String or last character is not a Haugul Syllable, it returns Error
Example
use josa::select; use josa::EunNeun; assert_eq!(select("사냥꾼", EunNeun)?, "은");