expression
Persian search keys — explicit letter mapping
For a chosen search policy, map Arabic yeh U+064A and kaf U+0643 to Persian yeh U+06CC and keheh U+06A9. Keep original text for display; these are distinct scalars, and canonical Unicode normalization does not merge them. This is not a universal rule for Arabic text. Expected stdout (not executed): کتاب ی Common mistake: Overwriting the original or applying Persian mappings to every language.
Formal Syntax & Structure
rust syntaxrust
text.chars().map(...).collect::<String>()Working Example
Example Snippetrust
fn main() { let input = "كتاب ي"; let key: String = input.chars().map(|c| match c { '\u{0643}' => '\u{06A9}', '\u{064A}' => '\u{06CC}', other => other }).collect(); println!("{key}");}