arr_rs/alphanumeric/types/
mod.rs

1/// char definition
2pub mod char;
3
4/// String definition
5pub mod string;
6
7use crate::core::types::{
8    ArrayElement,
9    collection::List,
10    tuple::tuple3::Tuple3,
11};
12
13/// Alphanumeric trait for array
14pub trait Alphanumeric: ArrayElement {
15
16    /// parse from &str
17    fn from_str(str: &str) -> Self;
18
19    /// append string with another
20    #[must_use]
21    fn _append(&self, other: Self) -> Self;
22
23    /// multiply string n-times
24    #[must_use]
25    fn _multiply(&self, n: usize) -> Self;
26
27    /// capitalize string
28    #[must_use]
29    fn _capitalize(&self) -> Self;
30
31    /// lower case string
32    #[must_use]
33    fn _lower(&self) -> Self;
34
35    /// upper case string
36    #[must_use]
37    fn _upper(&self) -> Self;
38
39    /// swap case in string
40    #[must_use]
41    fn _swapcase(&self) -> Self;
42
43    /// center string elements
44    #[must_use]
45    fn _center(&self, width: usize, fill_char: char) -> Self;
46
47    /// join string by separator
48    #[must_use]
49    fn _join(&self, sep: Self) -> Self;
50
51    /// partition string by first occurrence of separator
52    fn _partition(&self, sep: Self) -> Tuple3<Self, Self, Self>;
53
54    /// partition string by last occurrence of separator
55    fn _rpartition(&self, sep: Self) -> Tuple3<Self, Self, Self>;
56
57    /// split string by separator
58    fn _split(&self, sep: Self, max_split: Option<usize>) -> List<Self>;
59
60    /// split string by separator from right
61    fn _rsplit(&self, sep: Self, max_split: Option<usize>) -> List<Self>;
62
63    /// split string by line break character
64    fn _splitlines(&self, keep_ends: bool) -> List<Self>;
65
66    /// replace <old> string with <new> <count> times
67    #[must_use]
68    fn _replace(&self, old: Self, new: Self, count: Option<usize>) -> Self;
69
70    /// strips string elements
71    #[must_use]
72    fn _strip(&self, chars: Self) -> Self;
73
74    /// left-justifies string elements
75    #[must_use]
76    fn _ljust(&self, width: usize, fill_char: char) -> Self;
77
78    /// left-strips string elements
79    #[must_use]
80    fn _lstrip(&self, chars: Self) -> Self;
81
82    /// right-justifies string elements
83    #[must_use]
84    fn _rjust(&self, width: usize, fill_char: char) -> Self;
85
86    /// right-strips string elements
87    #[must_use]
88    fn _rstrip(&self, chars: Self) -> Self;
89
90    /// is equal to
91    fn _equal(&self, other: Self) -> bool;
92
93    /// is not equal to
94    fn _not_equal(&self, other: Self) -> bool;
95
96    /// is greater or equal to
97    fn _greater_equal(&self, other: Self) -> bool;
98
99    /// is less or equal to
100    fn _less_equal(&self, other: Self) -> bool;
101
102    /// is greater than
103    fn _greater(&self, other: Self) -> bool;
104
105    /// is less than
106    fn _less(&self, other: Self) -> bool;
107
108    /// counts non-overlapping occurrences of substring
109    fn _count(&self, sub: &str) -> usize;
110}