member function |
description |
const fn as_bytes(&self) -> &[u8] |
Converts a string slice to a byte slice |
pub fn bytes(&self) -> Bytes<'_> |
An iterator over bytes of a string slice |
pub fn chars(&self) -> Chars<'_> |
Returns iterator over chars of a string slice |
pub fn char_indices(&self) -> CharIndices<'_> |
Returns iterator over chars of a string slice, and their positions |
pub fn contains<'a, P>(&'a self, pat: P) -> bool |
Returns true if pattern P matches sub-slice of this string slice |
pub fn find<'a, P>(&'a self, pat: P) -> Option |
Returns byte index of first character of this string slice that matches pattern P.
Returns None if the pattern doesn't match.
|
pub fn is_ascii(&self) -> bool |
Checks if all characters in this string are within ASCII range |
pub fn is_char_boundary(&self, index: usize) -> bool |
Checks that index-th byte is first byte in UTF-8 code point sequence or end of the string |
pub const fn is_empty(&self) -> bool |
Returns true if self has length of zero bytes |
pub const fn len(&self) -> usize |
This length is in bytes, not chars or graphemes |
pub fn lines(&self) -> Lines<'_> |
An iterator over the lines of a string, as string slices
|
pub fn make_ascii_lowercase(&mut self) |
Converts this string to its ASCII lower case equivalent in-place |
pub fn make_ascii_uppercase(&mut self) |
Converts this string to its ASCII upper case equivalent in-place |
pub fn parse(&self) -> Result::Err> |
Parses this string slice into another type |
pub fn repeat(&self, n: usize) -> String |
Creates a new String by repeating a string n times |
pub fn replace<'a, P>(&'a self, from: P, to: &str) -> String |
Replaces all matches of pattern P with another string |
pub fn split<'a, P>(&'a self, pat: P) -> Split<'a, P> |
An iterator over substrings of this string slice, separated by characters matched by a pattern |
pub fn trim(&self) -> &str |
Returns a string slice with leading and trailing whitespace removed |
More methods ... |
std::string::String |