ASCII stands for American Standard Code for Information Interchange. It is a way of encoding a character set used for communication between computers. ASCII is the first among many encodings, which also include such encodings as the UTF-8, ISO-8859-1, etc.
A character is said to be ASCII if it is a number from 0 to 9, a letter from A to Z, or some special character.
We can check if a particular character is an ASCII uppercase character by using the is_ascii_uppercase()
method.
character.is_ascii_uppercase()
character
: This is the character we are checking to see if it is an ASCII uppercase character.
This method returns a boolean value. It returns true
when the character is an ASCII uppercase character. Otherwise, it returns false
.
fn main(){ // create some characters let char1 = 'R'; let char2 = '❤'; // non ASCII let char3 = 'L'; // let char4 = 'a'; let char5 = 'U'; // check if ASCII uppercase characters println!("{}", char1.is_ascii_uppercase()); println!("{}", char2.is_ascii_uppercase()); println!("{}", char3.is_ascii_uppercase()); println!("{}", char4.is_ascii_uppercase()); println!("{}", char5.is_ascii_uppercase()); }
RELATED TAGS
CONTRIBUTOR
View all Courses