scsys_core/traits/
string.rs

1/*
2    Appellation: string <module>
3    Contrib: FL03 <jo3mccain@icloud.com>
4*/
5#![cfg(feature = "alloc")]
6
7use alloc::string::String;
8
9pub trait StringExt {
10    /// Remove the first and last charecters of a string
11    fn remove_fnl(&self) -> &str;
12}
13
14impl StringExt for str {
15    fn remove_fnl(&self) -> &str {
16        &self[1..self.len() - 1]
17    }
18}
19
20impl StringExt for String {
21    fn remove_fnl(&self) -> &str {
22        &self[1..self.len() - 1]
23    }
24}
25
26pub trait StringFmt {
27    fn snake_case(&self) -> String;
28
29    fn title_case(&self) -> String;
30}