We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
is_ascii_*
1 parent aa6b295 commit e3774aaCopy full SHA for e3774aa
exercises/practice/robot-name/tests/robot-name.rs
@@ -3,11 +3,11 @@ use robot_name as robot;
3
fn assert_name_matches_pattern(n: &str) {
4
assert!(n.len() == 5, "name is exactly 5 characters long");
5
assert!(
6
- n[0..2].chars().all(|c| ('A'..='Z').contains(&c)),
+ n[0..2].chars().all(|c| c.is_ascii_uppercase()),
7
"name starts with 2 uppercase letters"
8
);
9
10
- n[2..].chars().all(|c| ('0'..='9').contains(&c)),
+ n[2..].chars().all(|c| c.is_ascii_digit()),
11
"name ends with 3 numbers"
12
13
}
0 commit comments