Convert text to uppercase
Give these short labels the same letter case. All four inputs use plain English letters and digits.
to_ascii_uppercase
Simple example
Change the case of two letters.
Start'ab'
ResultAB
fn main() {
println!("{}", "ab".to_ascii_uppercase());
}
AB
Advertisements
Everyday examples
Make the bus label match the route board.
Start'bus'
ResultBUS
fn main() {
println!("{}", "bus".to_ascii_uppercase());
}
BUS
Give an art shelf the same lettering as the other shelves.
Start'art'
ResultART
fn main() {
println!("{}", "art".to_ascii_uppercase());
}
ART
Normalize the letters in a ticket code and keep its digits.
Start'b12'
ResultB12
fn main() {
println!("{}", "b12".to_ascii_uppercase());
}
B12