1 | <?php |
||
17 | class Strings |
||
18 | { |
||
19 | /** |
||
20 | * Replace all specials characters from string and retuns only 128 basics |
||
21 | * NOTE: only for UTF-8 |
||
22 | * @param string $string |
||
23 | * @return string |
||
24 | */ |
||
25 | 1 | public static function replaceSpecialsChars($string) |
|
37 | |||
38 | /** |
||
39 | * Clear inputs for build in XML |
||
40 | * Only UTF-8 characters is acceptable |
||
41 | * & isolated, less than, greater than, quotation marks and apostrophes |
||
42 | * should be replaced by their html equivalent |
||
43 | * Carriage Return, Tab and Line Feed is not acceptable in strings |
||
44 | * Multiple spaces is not acceptable in strings |
||
45 | * And no other control character is acceptable either |
||
46 | * @param string|null $input |
||
47 | * @return string|null |
||
48 | */ |
||
49 | 1 | public static function replaceUnacceptableCharacters($input) |
|
78 | |||
79 | /** |
||
80 | * Remove all non numeric characters from string |
||
81 | * @param string $string |
||
82 | * @return string |
||
83 | */ |
||
84 | 1 | public static function onlyNumbers($string) |
|
88 | |||
89 | /** |
||
90 | * Remove unwanted attributes, prefixes, sulfixes and other control |
||
91 | * characters like \r \n \s \t |
||
92 | * @param string $string |
||
93 | * @param boolean $removeEncodingTag remove encoding tag from a xml |
||
94 | * @return string |
||
95 | */ |
||
96 | 2 | public static function clearXmlString($string, $removeEncodingTag = false) |
|
114 | |||
115 | /** |
||
116 | * Remove all characters between markers |
||
117 | * @param string $string |
||
118 | * @param string $beginning |
||
119 | * @param string $end |
||
120 | * @return string |
||
121 | */ |
||
122 | 2 | public static function deleteAllBetween($string, $beginning, $end) |
|
132 | |||
133 | /** |
||
134 | * Clears the xml after adding the protocol, removing repeated namespaces |
||
135 | * @param string $string |
||
136 | * @return string |
||
137 | */ |
||
138 | 1 | public static function clearProtocoledXML($string) |
|
151 | |||
152 | /** |
||
153 | * Remove some alien chars from txt |
||
154 | * @param string $txt |
||
155 | * @return string |
||
156 | */ |
||
157 | 1 | public static function removeSomeAlienCharsfromTxt($txt) |
|
167 | |||
168 | /** |
||
169 | * Creates a string ramdomically with the specified length |
||
170 | * @param int $length |
||
171 | * @return string |
||
172 | */ |
||
173 | 1 | public static function randomString($length) |
|
184 | } |
||
185 |