Lines Matching defs:char

163     fn pred(c: char) -> bool {
175 b.iter(|| assert_eq!(s.split(|c: char| c == ' ').count(), len));
183 let c: &[char] = &[' '];
350 make_test!(trim_ascii_char, s, { s.trim_matches(|c: char| c.is_ascii()) });
351 make_test!(trim_start_ascii_char, s, { s.trim_start_matches(|c: char| c.is_ascii()) });
352 make_test!(trim_end_ascii_char, s, { s.trim_end_matches(|c: char| c.is_ascii()) });
3509 assert_eq!("hello".find(|c: char| c == 'o'), Some(4));
3511 assert!("hello".find(|c: char| c == 'x').is_none());
3513 assert_eq!("ประเทศไทย中华Việt Nam".find(|c: char| c == '华'), Some(30));
3519 assert_eq!("hello".rfind(|c: char| c == 'o'), Some(4));
3521 assert!("hello".rfind(|c: char| c == 'x').is_none());
3523 assert_eq!("ประเทศไทย中华Việt Nam".rfind(|c: char| c == '华'), Some(30));
3753 assert_eq!("qwer123zxc789".replacen(char::is_numeric, "", 3), "qwerzxc789");
4151 "byte index 4 is not a char boundary; it is inside 'α' (bytes 3..5) of";
4158 "byte index 6 is not a char boundary; it is inside 'β' (bytes 5..7) of";
4165 "byte index 4 is not a char boundary; it is inside 'α' (bytes 3..5) of";
4172 "byte index 6 is not a char boundary; it is inside 'β' (bytes 5..7) of";
4179 "byte index 4 is not a char boundary; it is inside 'α' (bytes 3..5) of";
4186 "byte index 6 is not a char boundary; it is inside 'β' (bytes 5..7) of";
4193 "byte index 6 is not a char boundary; it is inside 'β' (bytes 5..7) of";
4258 assert!(s.is_char_boundary(i), "{} is a char boundary in {:?}", i, s);
4262 "{} should not be a char boundary in {:?}",
4272 let v: &[char] = &[];
4274 let chars: &[char] = &['*', ' '];
4280 let chars: &[char] = &['1', '2'];
4282 assert_eq!("123foo1bar123".trim_start_matches(|c: char| c.is_numeric()), "foo1bar123");
4287 let v: &[char] = &[];
4289 let chars: &[char] = &['*', ' '];
4295 let chars: &[char] = &['1', '2'];
4297 assert_eq!("123foo1bar123".trim_end_matches(|c: char| c.is_numeric()), "123foo1bar");
4302 let v: &[char] = &[];
4304 let chars: &[char] = &['*', ' '];
4310 let chars: &[char] = &['1', '2'];
4312 assert_eq!("123foo1bar123".trim_matches(|c: char| c.is_numeric()), "foo1bar");
4625 for c in (0..0x110000).filter_map(std::char::from_u32) {
4637 for c in (0..0x110000).filter_map(std::char::from_u32) {
4780 let split: Vec<&str> = data.splitn(4, |c: char| c == ' ').collect();
4787 let split: Vec<&str> = data.splitn(4, |c: char| c == 'ä').collect();
4812 .split_inclusive(|c: char| {
4835 .split_inclusive(|c: char| {
4855 let split: Vec<&str> = data.rsplit(|c: char| c == 'ä').collect();
4869 let split: Vec<&str> = data.rsplitn(2, |c: char| c == 'ä').collect();
5037 let mut split: Vec<&str> = data.rsplitn(4, |c: char| c == ' ').collect();
5046 let mut split: Vec<&str> = data.rsplitn(4, |c: char| c == 'ä').collect();
5062 let split: Vec<&str> = data.split(|c: char| c == ' ').collect();
5065 let mut rsplit: Vec<&str> = data.split(|c: char| c == ' ').rev().collect();
5077 let split: Vec<&str> = data.split(|c: char| c == 'ä').collect();
5080 let mut rsplit: Vec<&str> = data.split(|c: char| c == 'ä').rev().collect();
5136 assert_eq!(" \t a \t ".trim_start_matches(|c: char| c.is_whitespace()), "a \t ");
5137 assert_eq!(" \t a \t ".trim_end_matches(|c: char| c.is_whitespace()), " \t a");
5138 assert_eq!(" \t a \t ".trim_start_matches(|c: char| c.is_whitespace()), "a \t ");
5139 assert_eq!(" \t a \t ".trim_end_matches(|c: char| c.is_whitespace()), " \t a");
5140 assert_eq!(" \t a \t ".trim_matches(|c: char| c.is_whitespace()), "a");
5141 assert_eq!(" \t \t ".trim_start_matches(|c: char| c.is_whitespace()), "");
5142 assert_eq!(" \t \t ".trim_end_matches(|c: char| c.is_whitespace()), "");
5143 assert_eq!(" \t \t ".trim_start_matches(|c: char| c.is_whitespace()), "");
5144 assert_eq!(" \t \t ".trim_end_matches(|c: char| c.is_whitespace()), "");
5145 assert_eq!(" \t \t ".trim_matches(|c: char| c.is_whitespace()), "");
5435 ("a1b2c3", char::is_numeric) -> ["1", "2", "3"];
5442 ("a1b2c3", char::is_numeric) -> [(1, "1"), (3, "2"), (5, "3")];
5520 let yen: char = '¥'; // 0xa5
5521 let c_cedilla: char = 'ç'; // 0xe7
5522 let thorn: char = 'þ'; // 0xfe
5523 let y_diaeresis: char = 'ÿ'; // 0xff
5524 let pi: char = 'Π'; // 0x3a0
5547 let oo: char = 'Ö';
5571 let chs: Vec<char> = vec!['e', 'é', '€', '\u{10000}'];
5573 let schs: Vec<char> = s.chars().collect();
5776 assert!(core::char::decode_utf16(u.iter().cloned()).all(|r| r.is_ok()));
11756 let d = VecDeque::<char>::new();
15266 /// assert_eq!("foo foo new23 foo", s.replacen(char::is_numeric, "new", 1));
15367 fn case_ignoreable_then_cased<I: Iterator<Item = char>>(iter: I) -> bool {
16216 use core::char::{decode_utf16, REPLACEMENT_CHARACTER};
16248 /// You can append a [`char`] to a `String` with the [`push`] method, and
16670 /// [U+FFFD]: core::char::REPLACEMENT_CHARACTER
16785 /// [U+FFFD]: core::char::REPLACEMENT_CHARACTER
17233 /// Appends the given [`char`] to the end of this `String`.
17250 pub fn push(&mut self, ch: char) {
17288 /// Panics if `new_len` does not lie on a [`char`] boundary.
17329 pub fn pop(&mut self) -> Option<char> {
17338 /// Removes a [`char`] from this `String` at a byte position and returns it.
17346 /// or if it does not lie on a [`char`] boundary.
17361 pub fn remove(&mut self, idx: usize) -> char {
17364 None => panic!("cannot remove a char from the end of a string"),
17461 F: FnMut(char) -> bool,
17496 // Point idx to the next char
17511 /// lie on a [`char`] boundary.
17528 pub fn insert(&mut self, idx: usize, ch: char) {
17558 /// lie on a [`char`] boundary.
17611 /// Returns the length of this `String`, in bytes, not [`char`]s or
17717 /// Panics if the starting point or end point do not lie on a [`char`]
17767 /// Panics if the starting point or end point do not lie on a [`char`]
17934 impl FromIterator<char> for String {
17935 fn from_iter<I: IntoIterator<Item = char>>(iter: I) -> String {
17943 impl<'a> FromIterator<&'a char> for String {
17944 fn from_iter<I: IntoIterator<Item = &'a char>>(iter: I) -> String {
18007 impl Extend<char> for String {
18008 fn extend<I: IntoIterator<Item = char>>(&mut self, iter: I) {
18016 fn extend_one(&mut self, c: char) {
18027 impl<'a> Extend<&'a char> for String {
18028 fn extend<I: IntoIterator<Item = &'a char>>(&mut self, iter: I) {
18033 fn extend_one(&mut self, &c: &'a char) {
18455 impl ToString for char {
18645 impl<'a> FromIterator<char> for Cow<'a, str> {
18646 fn from_iter<I: IntoIterator<Item = char>>(it: I) -> Cow<'a, str> {
18695 fn write_char(&mut self, c: char) -> fmt::Result {
18781 type Item = char;
18784 fn next(&mut self) -> Option<char> {
18793 fn last(mut self) -> Option<char> {
18801 fn next_back(&mut self) -> Option<char> {
18810 impl From<char> for String {
18812 fn from(c: char) -> Self {
43639 tester.push_back(i as char);
43643 tester.push_front(i as char);
43657 tester.push_back(i as char);
43661 tester.push_front(i as char);
46528 impl_is_zero!(char, |x| x == '\0');
47271 /// to build a `Vec<u8>` from a pointer to a C `char` array with length `size_t`.
47409 /// to build a `Vec<u8>` from a pointer to a C `char` array with length `size_t`.