Convert a char to upper case in Rust
ToUppercase
is an iterator, because the uppercase version of the character may be composed of several codepoints, as delnan pointed in the comments. You can convert that to a Vector of characters:Example of Converting a char to upper case in Rust
fn main() {
let fi_upper: Vec<_> = 'k'.to_uppercase().collect();
println!("{:?}", fi_upper);
}
Output
['K']