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§

source

fn to_md5_lowercase(&self) -> String

转换成md5小写

source

fn to_md5_uppercase(&self) -> String

转换成md5大写

source

fn is_http(&self) -> bool

是否为http(s)://开头

source

fn char_length(&self) -> CharIndex

获取字符数

source

fn char_at(&self, idx: CharIndex) -> Option<char>

获取字符索引

source

fn index_char_of(&self, c: char) -> Option<CharIndex>

获取字符的第一次出现位置的索引

source

fn last_index_char_of(&self, c: char) -> Option<CharIndex>

获取字符的最后一次出现位置的索引

source

fn index_of(&self, s: &str) -> Option<CharIndex>

获取子字符串的第一次出现位置的索引

source

fn last_index_of(&self, s: &str) -> Option<CharIndex>

获取子字符串的最后一次出现位置的索引

source

fn substring(&self, range: Range<CharIndex>) -> Cow<'_, str>

子字符串(按字符索引)

source

fn substring_after(&self, separator: &str) -> Cow<'_, str>

子字符串

source

fn substring_after_last(&self, separator: &str) -> Cow<'_, str>

子字符串

source

fn substring_before(&self, separator: &str) -> Cow<'_, str>

子字符串

source

fn substring_before_last(&self, separator: &str) -> Cow<'_, str>

子字符串

source

fn substring_between(&self, open: &str, close: &str) -> Cow<'_, str>

子字符串

source

fn substrings_between(&self, open: &str, close: &str) -> Vec<Cow<'_, str>>

子字符串

Implementors§

source§

impl<T> StringExt for Twhere T: AsRef<str>,