1 | <?php |
||
7 | class S |
||
8 | { |
||
9 | /** |
||
10 | * Sets encoding for using in morphos/* functions. |
||
11 | * @param string $encoding |
||
12 | * @return bool |
||
13 | */ |
||
14 | public static function setEncoding($encoding) |
||
24 | |||
25 | /** |
||
26 | * Calculates count of characters in string. |
||
27 | * @param $string |
||
28 | * @return bool|int |
||
29 | */ |
||
30 | 34 | public static function length($string) |
|
42 | |||
43 | /** |
||
44 | * Slices string like python. |
||
45 | * @param string $string |
||
46 | * @param int $start |
||
47 | * @param int|null $end |
||
48 | * @return bool|string |
||
49 | */ |
||
50 | 1392 | public static function slice($string, $start, $end = null) |
|
66 | |||
67 | /** |
||
68 | * Lower case. |
||
69 | * @param $string |
||
70 | * @return bool|string |
||
71 | */ |
||
72 | 1647 | public static function lower($string) |
|
80 | |||
81 | /** |
||
82 | * Upper case. |
||
83 | * @param $string |
||
84 | * @return bool|string |
||
85 | */ |
||
86 | 201 | public static function upper($string) |
|
94 | |||
95 | /** |
||
96 | * Name case. (ex: Thomas, Lewis) |
||
97 | * @param $string |
||
98 | * @return bool|string |
||
99 | */ |
||
100 | 199 | public static function name($string) |
|
110 | |||
111 | /** |
||
112 | * multiple substr_count(). |
||
113 | * @param $string |
||
114 | * @param array $chars |
||
115 | * @return bool|int |
||
116 | */ |
||
117 | public static function countChars($string, array $chars) |
||
125 | |||
126 | /** |
||
127 | * @param string $string |
||
128 | * @param string $char |
||
129 | * @return bool|string |
||
130 | */ |
||
131 | 7 | public static function findFirstPosition($string, $char) |
|
139 | |||
140 | /** |
||
141 | * @param string $string |
||
142 | * @param string $char |
||
143 | * @return bool|string |
||
144 | */ |
||
145 | 5 | public static function findLastPosition($string, $char) |
|
153 | |||
154 | /** |
||
155 | * @param $string |
||
156 | * @param array $chars |
||
157 | * @return bool|string |
||
158 | */ |
||
159 | 43 | public static function findLastPositionForOneOfChars($string, array $chars) |
|
178 | |||
179 | /** |
||
180 | * @param $string |
||
181 | * @param $substring |
||
182 | * @param bool $caseSensetive |
||
183 | * @param int $startOffset |
||
184 | * @return string|false |
||
185 | */ |
||
186 | 1 | public static function indexOf($string, $substring, $caseSensetive = false, $startOffset = 0) |
|
194 | } |
||
195 |