hanguleam/editor
Values
pub fn remove_last_character(text: String) -> String
Removes the last character component from a Korean string, intelligently handling Korean syllable decomposition. This function removes the last “logical” character unit from the input string. For complete Korean syllables, it removes the last jamo component (consonant or vowel part) rather than the entire character, allowing for fine-grained text editing that matches Korean input method behavior.
Examples
remove_last_character("안녕하세요 값")
// -> "안녕하세요 갑"
remove_last_character("전화")
// -> "전호"
remove_last_character("Hello")
// -> "Hell"
remove_last_character("")
// -> ""