to_uppercase()
is a method of the character data type in Rust. It converts a character to its uppercase version. Similar methods are also present in other programming languages.
character.to_uppercase()
character
: This is the character that we want to convert to uppercase.
The value returned is the uppercase version of character
.
fn main(){ // create some characters let char1 = 'r'; let char2 = 'u'; let char3 = 's'; let char4 = 't'; // convert characters to uppercase println!("{}", char1.to_uppercase()); println!("{}", char2.to_uppercase()); println!("{}", char3.to_uppercase()); println!("{}", char4.to_uppercase()); }
to_uppercase()
method, we convert the characters to uppercase and print them to the console screen.RELATED TAGS
CONTRIBUTOR
View all Courses