summary refs log tree commit diff
path: root/library/alloc/tests/str.rs
AgeCommit message (Collapse)AuthorLines
2021-12-23Rollup merge of #88858 - spektom:to_lower_upper_rev, r=dtolnayMatthias Krüger-0/+31
Allow reverse iteration of lowercase'd/uppercase'd chars The PR implements `DoubleEndedIterator` trait for `ToLowercase` and `ToUppercase`. This enables reverse iteration of lowercase/uppercase variants of character sequences. One of use cases: determining whether a char sequence is a suffix of another one. Example: ```rust fn endswith_ignore_case(s1: &str, s2: &str) -> bool { for eob in s1 .chars() .flat_map(|c| c.to_lowercase()) .rev() .zip_longest(s2.chars().flat_map(|c| c.to_lowercase()).rev()) { match eob { EitherOrBoth::Both(c1, c2) => { if c1 != c2 { return false; } } EitherOrBoth::Left(_) => return true, EitherOrBoth::Right(_) => return false, } } true } ```
2021-12-14Fix a bunch of typosFrank Steffahn-1/+1
2021-11-18Make slice->str conversion and related functions constMaybe Waffle-3/+61
This commit makes the following functions from `core::str` `const fn`: - `from_utf8[_mut]` (`feature(const_str_from_utf8)`) - `from_utf8_unchecked_mut` (`feature(const_str_from_utf8_unchecked_mut)`) - `Utf8Error::{valid_up_to,error_len}` (`feature(const_str_from_utf8)`)
2021-10-30Add #[must_use] to remaining core functionsJohn Kugelman-1/+1
2021-09-11Allow reverse iteration of lowercase'd/uppercase'd charsMichael Spector-0/+31
2021-07-11Add test for the fixAlexis Bourget-0/+41
2021-06-18Lint for unused borrows as part of UNUSED_MUST_USEhi-rustin-5/+5
2021-02-03Fixes #80335Yechan Bae-0/+30
2020-12-02break formatting so rustfmt is happyRalf Jung-1/+2
2020-12-02disable a ptr equality test on MiriRalf Jung-1/+5
2020-11-30Make ui test that are run-pass and do not test the compiler itself library testsChristiaan Dirkx-1/+95
2020-10-20Check for exhaustion in SliceIndex for RangeInclusiveJosh Stone-0/+29
2020-09-05Move Various str tests in libraryAyush Kumar Mishra-0/+21
2020-07-28Add str::[r]split_onceAleksey Kladov-0/+24
This is useful for quick&dirty parsing of key: value config pairs
2020-07-27mv std libs to library/mark-0/+1899