std-method
str::make_ascii_uppercase
Modify ASCII letters in place without changing UTF-8 byte length. Other characters remain untouched. Expected stdout (not executed): AB فارسی Common mistake: Expecting non-ASCII uppercase conversion.
Formal Syntax & Structure
rust syntaxrust
fn make_ascii_uppercase(&mut self)Working Example
Example Snippetrust
fn main() { let mut label = String::from("ab فارسی"); label.make_ascii_uppercase(); println!("{label}");}