We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cecdb18 commit e48c684Copy full SHA for e48c684
library/core/src/unicode/unicode_data.rs
@@ -549,16 +549,24 @@ pub mod white_space {
549
#[rustfmt::skip]
550
pub mod conversions {
551
pub fn to_lower(c: char) -> [char; 3] {
552
- match bsearch_case_table(c, LOWERCASE_TABLE) {
553
- None => [c, '\0', '\0'],
554
- Some(index) => LOWERCASE_TABLE[index].1,
+ if c.is_ascii() {
+ [(c as u8).to_ascii_lowercase() as char, '\0', '\0']
+ } else {
555
+ match bsearch_case_table(c, LOWERCASE_TABLE) {
556
+ None => [c, '\0', '\0'],
557
+ Some(index) => LOWERCASE_TABLE[index].1,
558
+ }
559
}
560
561
562
pub fn to_upper(c: char) -> [char; 3] {
- match bsearch_case_table(c, UPPERCASE_TABLE) {
- Some(index) => UPPERCASE_TABLE[index].1,
563
564
+ [(c as u8).to_ascii_uppercase() as char, '\0', '\0']
565
566
+ match bsearch_case_table(c, UPPERCASE_TABLE) {
567
568
+ Some(index) => UPPERCASE_TABLE[index].1,
569
570
571
572
0 commit comments