pub struct StringUtils;
Expand description
字符串工具
Implementations§
Source§impl StringUtils
impl StringUtils
Sourcepub fn camel_to_snake(s: &str) -> String
pub fn camel_to_snake(s: &str) -> String
驼峰转下划线
Sourcepub fn snake_to_camel(s: &str) -> String
pub fn snake_to_camel(s: &str) -> String
下划线转驼峰
Sourcepub fn capitalize(s: &str) -> String
pub fn capitalize(s: &str) -> String
首字母大写
Sourcepub fn uncapitalize(s: &str) -> String
pub fn uncapitalize(s: &str) -> String
首字母小写
Sourcepub fn random_string(length: usize) -> String
pub fn random_string(length: usize) -> String
生成随机字符串
Sourcepub fn to_camel_case(s: &str) -> String
pub fn to_camel_case(s: &str) -> String
下划线转驼峰
Sourcepub fn to_snake_case(s: &str) -> String
pub fn to_snake_case(s: &str) -> String
驼峰转下划线
Sourcepub fn regex_match(s: &str, pattern: &Regex) -> bool
pub fn regex_match(s: &str, pattern: &Regex) -> bool
缓存正则表达式
pub fn regex_from_pattern(pattern: &str) -> Regex
pub fn option_is_empty(option: &Option<String>) -> bool
pub fn string_to_vec_u8(s: &str) -> Vec<u8> ⓘ
pub fn deserialize_str_to_i32<'de, D>(
deserializer: D,
) -> Result<Option<i32>, D::Error>where
D: Deserializer<'de>,
pub fn serialize_i32_to_string<S>(
value: &Option<i32>,
serializer: S,
) -> Result<S::Ok, S::Error>where
S: Serializer,
pub fn serialize_vec_u8_to_string<S>(
value: &Option<Vec<u8>>,
serializer: S,
) -> Result<S::Ok, S::Error>where
S: Serializer,
pub fn redis_info_to_map(info: &str) -> HashMap<String, String>
pub fn redis_command_stats_to_map(info: &str) -> Vec<HashMap<String, String>>
Auto Trait Implementations§
impl Freeze for StringUtils
impl RefUnwindSafe for StringUtils
impl Send for StringUtils
impl Sync for StringUtils
impl Unpin for StringUtils
impl UnwindSafe for StringUtils
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more