Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#72371 - Elrendio:char_documentation, r=stev…
…eklabnik FIX - Char documentation for unexperienced users This is my first PR on rust and even if I've read [CONTRIBUTING.md](https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#pull-requests) I'm ensure everything is perfect. Sorry if I didn't follow the exact procedure. **What it does:** - Add an example in the char documentation **Explanation** Unexperienced users might not know that punctuation is `Case_Ignorable` and not `Uppercase` and `Lowercase` which mean that when checking if a string is uppercase one might be tempted to write: ```rust my_string.chars().all(char::is_uppercase) ``` However this will return false for `"HELLO WORLD"` which is not intuitive. Since the function `is_case_ignorable` doesn't exists I believe the correct way to check is: ```rust !my_string.chars().any(char::is_lowercase) ``` The aim of this example is to prevent unexperienced users to make an error which punctuation chars.
- Loading branch information