pub trait StringExt {
Show 16 methods
// Required methods
fn to_md5_lowercase(&self) -> String;
fn to_md5_uppercase(&self) -> String;
fn is_http(&self) -> bool;
fn char_length(&self) -> CharIndex;
fn char_at(&self, idx: CharIndex) -> Option<char>;
fn index_char_of(&self, c: char) -> Option<CharIndex>;
fn last_index_char_of(&self, c: char) -> Option<CharIndex>;
fn index_of(&self, s: &str) -> Option<CharIndex>;
fn last_index_of(&self, s: &str) -> Option<CharIndex>;
fn substring(&self, range: Range<CharIndex>) -> Cow<'_, str>;
fn substring_after(&self, separator: &str) -> Cow<'_, str>;
fn substring_after_last(&self, separator: &str) -> Cow<'_, str>;
fn substring_before(&self, separator: &str) -> Cow<'_, str>;
fn substring_before_last(&self, separator: &str) -> Cow<'_, str>;
fn substring_between(&self, open: &str, close: &str) -> Cow<'_, str>;
fn substrings_between(&self, open: &str, close: &str) -> Vec<Cow<'_, str>>;
}Expand description
字符串扩展
Required Methods§
sourcefn to_md5_lowercase(&self) -> String
fn to_md5_lowercase(&self) -> String
转换成md5小写
sourcefn to_md5_uppercase(&self) -> String
fn to_md5_uppercase(&self) -> String
转换成md5大写
sourcefn char_length(&self) -> CharIndex
fn char_length(&self) -> CharIndex
获取字符数
sourcefn index_char_of(&self, c: char) -> Option<CharIndex>
fn index_char_of(&self, c: char) -> Option<CharIndex>
获取字符的第一次出现位置的索引
sourcefn last_index_char_of(&self, c: char) -> Option<CharIndex>
fn last_index_char_of(&self, c: char) -> Option<CharIndex>
获取字符的最后一次出现位置的索引
sourcefn last_index_of(&self, s: &str) -> Option<CharIndex>
fn last_index_of(&self, s: &str) -> Option<CharIndex>
获取子字符串的最后一次出现位置的索引
sourcefn substring_after(&self, separator: &str) -> Cow<'_, str>
fn substring_after(&self, separator: &str) -> Cow<'_, str>
子字符串
sourcefn substring_after_last(&self, separator: &str) -> Cow<'_, str>
fn substring_after_last(&self, separator: &str) -> Cow<'_, str>
子字符串
sourcefn substring_before(&self, separator: &str) -> Cow<'_, str>
fn substring_before(&self, separator: &str) -> Cow<'_, str>
子字符串
sourcefn substring_before_last(&self, separator: &str) -> Cow<'_, str>
fn substring_before_last(&self, separator: &str) -> Cow<'_, str>
子字符串