| 1 |
<?php |
| 2 |
|
| 3 |
namespace PhpOffice\PhpSpreadsheet\Calculation; |
| 4 |
|
| 5 |
use DateTimeInterface; |
| 6 |
|
| 7 |
/** |
| 8 |
* @deprecated 1.18.0 |
| 9 |
*/ |
| 10 |
class TextData |
| 11 |
{ |
| 12 |
/** |
| 13 |
* CHARACTER. |
| 14 |
* |
| 15 |
* @deprecated 1.18.0 |
| 16 |
* Use the character() method in the TextData\CharacterConvert class instead |
| 17 |
* @see TextData\CharacterConvert::character() |
| 18 |
* |
| 19 |
* @param string $character Value |
| 20 |
* |
| 21 |
* @return array|string |
| 22 |
*/ |
| 23 |
public static function CHARACTER($character) |
| 24 |
{ |
| 25 |
return TextData\CharacterConvert::character($character); |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* TRIMNONPRINTABLE. |
| 30 |
* |
| 31 |
* @deprecated 1.18.0 |
| 32 |
* Use the nonPrintable() method in the TextData\Trim class instead |
| 33 |
* @see TextData\Trim::nonPrintable() |
| 34 |
* |
| 35 |
* @param mixed $stringValue Value to check |
| 36 |
* |
| 37 |
* @return null|array|string |
| 38 |
*/ |
| 39 |
public static function TRIMNONPRINTABLE($stringValue = '') |
| 40 |
{ |
| 41 |
return TextData\Trim::nonPrintable($stringValue); |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* TRIMSPACES. |
| 46 |
* |
| 47 |
* @deprecated 1.18.0 |
| 48 |
* Use the spaces() method in the TextData\Trim class instead |
| 49 |
* @see TextData\Trim::spaces() |
| 50 |
* |
| 51 |
* @param mixed $stringValue Value to check |
| 52 |
* |
| 53 |
* @return array|string |
| 54 |
*/ |
| 55 |
public static function TRIMSPACES($stringValue = '') |
| 56 |
{ |
| 57 |
return TextData\Trim::spaces($stringValue); |
| 58 |
} |
| 59 |
|
| 60 |
/** |
| 61 |
* ASCIICODE. |
| 62 |
* |
| 63 |
* @deprecated 1.18.0 |
| 64 |
* Use the code() method in the TextData\CharacterConvert class instead |
| 65 |
* @see TextData\CharacterConvert::code() |
| 66 |
* |
| 67 |
* @param array|string $characters Value |
| 68 |
* |
| 69 |
* @return array|int|string A string if arguments are invalid |
| 70 |
*/ |
| 71 |
public static function ASCIICODE($characters) |
| 72 |
{ |
| 73 |
return TextData\CharacterConvert::code($characters); |
| 74 |
} |
| 75 |
|
| 76 |
/** |
| 77 |
* CONCATENATE. |
| 78 |
* |
| 79 |
* @deprecated 1.18.0 |
| 80 |
* Use the CONCATENATE() method in the TextData\Concatenate class instead |
| 81 |
* @see TextData\Concatenate::CONCATENATE() |
| 82 |
* |
| 83 |
* @param array $args |
| 84 |
* |
| 85 |
* @return string |
| 86 |
*/ |
| 87 |
public static function CONCATENATE(...$args) |
| 88 |
{ |
| 89 |
return TextData\Concatenate::CONCATENATE(...$args); |
| 90 |
} |
| 91 |
|
| 92 |
/** |
| 93 |
* DOLLAR. |
| 94 |
* |
| 95 |
* This function converts a number to text using currency format, with the decimals rounded to the specified place. |
| 96 |
* The format used is $#,##0.00_);($#,##0.00).. |
| 97 |
* |
| 98 |
* @deprecated 1.18.0 |
| 99 |
* Use the DOLLAR() method in the TextData\Format class instead |
| 100 |
* @see TextData\Format::DOLLAR() |
| 101 |
* |
| 102 |
* @param float $value The value to format |
| 103 |
* @param int $decimals The number of digits to display to the right of the decimal point. |
| 104 |
* If decimals is negative, number is rounded to the left of the decimal point. |
| 105 |
* If you omit decimals, it is assumed to be 2 |
| 106 |
* |
| 107 |
* @return array|string |
| 108 |
*/ |
| 109 |
public static function DOLLAR($value = 0, $decimals = 2) |
| 110 |
{ |
| 111 |
return TextData\Format::DOLLAR($value, $decimals); |
| 112 |
} |
| 113 |
|
| 114 |
/** |
| 115 |
* FIND. |
| 116 |
* |
| 117 |
* @deprecated 1.18.0 |
| 118 |
* Use the sensitive() method in the TextData\Search class instead |
| 119 |
* @see TextData\Search::sensitive() |
| 120 |
* |
| 121 |
* @param array|string $needle The string to look for |
| 122 |
* @param array|string $haystack The string in which to look |
| 123 |
* @param array|int $offset Offset within $haystack |
| 124 |
* |
| 125 |
* @return array|int|string |
| 126 |
*/ |
| 127 |
public static function SEARCHSENSITIVE($needle, $haystack, $offset = 1) |
| 128 |
{ |
| 129 |
return TextData\Search::sensitive($needle, $haystack, $offset); |
| 130 |
} |
| 131 |
|
| 132 |
/** |
| 133 |
* SEARCH. |
| 134 |
* |
| 135 |
* @deprecated 1.18.0 |
| 136 |
* Use the insensitive() method in the TextData\Search class instead |
| 137 |
* @see TextData\Search::insensitive() |
| 138 |
* |
| 139 |
* @param array|string $needle The string to look for |
| 140 |
* @param array|string $haystack The string in which to look |
| 141 |
* @param array|int $offset Offset within $haystack |
| 142 |
* |
| 143 |
* @return array|int|string |
| 144 |
*/ |
| 145 |
public static function SEARCHINSENSITIVE($needle, $haystack, $offset = 1) |
| 146 |
{ |
| 147 |
return TextData\Search::insensitive($needle, $haystack, $offset); |
| 148 |
} |
| 149 |
|
| 150 |
/** |
| 151 |
* FIXEDFORMAT. |
| 152 |
* |
| 153 |
* @deprecated 1.18.0 |
| 154 |
* Use the FIXEDFORMAT() method in the TextData\Format class instead |
| 155 |
* @see TextData\Format::FIXEDFORMAT() |
| 156 |
* |
| 157 |
* @param mixed $value Value to check |
| 158 |
* @param int $decimals |
| 159 |
* @param bool $no_commas |
| 160 |
* |
| 161 |
* @return array|string |
| 162 |
*/ |
| 163 |
public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = false) |
| 164 |
{ |
| 165 |
return TextData\Format::FIXEDFORMAT($value, $decimals, $no_commas); |
| 166 |
} |
| 167 |
|
| 168 |
/** |
| 169 |
* LEFT. |
| 170 |
* |
| 171 |
* @deprecated 1.18.0 |
| 172 |
* Use the left() method in the TextData\Extract class instead |
| 173 |
* @see TextData\Extract::left() |
| 174 |
* |
| 175 |
* @param array|string $value Value |
| 176 |
* @param array|int $chars Number of characters |
| 177 |
* |
| 178 |
* @return array|string |
| 179 |
*/ |
| 180 |
public static function LEFT($value = '', $chars = 1) |
| 181 |
{ |
| 182 |
return TextData\Extract::left($value, $chars); |
| 183 |
} |
| 184 |
|
| 185 |
/** |
| 186 |
* MID. |
| 187 |
* |
| 188 |
* @deprecated 1.18.0 |
| 189 |
* Use the mid() method in the TextData\Extract class instead |
| 190 |
* @see TextData\Extract::mid() |
| 191 |
* |
| 192 |
* @param array|string $value Value |
| 193 |
* @param array|int $start Start character |
| 194 |
* @param array|int $chars Number of characters |
| 195 |
* |
| 196 |
* @return array|string |
| 197 |
*/ |
| 198 |
public static function MID($value = '', $start = 1, $chars = null) |
| 199 |
{ |
| 200 |
return TextData\Extract::mid($value, $start, $chars); |
| 201 |
} |
| 202 |
|
| 203 |
/** |
| 204 |
* RIGHT. |
| 205 |
* |
| 206 |
* @deprecated 1.18.0 |
| 207 |
* Use the right() method in the TextData\Extract class instead |
| 208 |
* @see TextData\Extract::right() |
| 209 |
* |
| 210 |
* @param array|string $value Value |
| 211 |
* @param array|int $chars Number of characters |
| 212 |
* |
| 213 |
* @return array|string |
| 214 |
*/ |
| 215 |
public static function RIGHT($value = '', $chars = 1) |
| 216 |
{ |
| 217 |
return TextData\Extract::right($value, $chars); |
| 218 |
} |
| 219 |
|
| 220 |
/** |
| 221 |
* STRINGLENGTH. |
| 222 |
* |
| 223 |
* @deprecated 1.18.0 |
| 224 |
* Use the length() method in the TextData\Text class instead |
| 225 |
* @see TextData\Text::length() |
| 226 |
* |
| 227 |
* @param string $value Value |
| 228 |
* |
| 229 |
* @return array|int |
| 230 |
*/ |
| 231 |
public static function STRINGLENGTH($value = '') |
| 232 |
{ |
| 233 |
return TextData\Text::length($value); |
| 234 |
} |
| 235 |
|
| 236 |
/** |
| 237 |
* LOWERCASE. |
| 238 |
* |
| 239 |
* Converts a string value to lower case. |
| 240 |
* |
| 241 |
* @deprecated 1.18.0 |
| 242 |
* Use the lower() method in the TextData\CaseConvert class instead |
| 243 |
* @see TextData\CaseConvert::lower() |
| 244 |
* |
| 245 |
* @param array|string $mixedCaseString |
| 246 |
* |
| 247 |
* @return array|string |
| 248 |
*/ |
| 249 |
public static function LOWERCASE($mixedCaseString) |
| 250 |
{ |
| 251 |
return TextData\CaseConvert::lower($mixedCaseString); |
| 252 |
} |
| 253 |
|
| 254 |
/** |
| 255 |
* UPPERCASE. |
| 256 |
* |
| 257 |
* Converts a string value to upper case. |
| 258 |
* |
| 259 |
* @deprecated 1.18.0 |
| 260 |
* Use the upper() method in the TextData\CaseConvert class instead |
| 261 |
* @see TextData\CaseConvert::upper() |
| 262 |
* |
| 263 |
* @param string $mixedCaseString |
| 264 |
* |
| 265 |
* @return array|string |
| 266 |
*/ |
| 267 |
public static function UPPERCASE($mixedCaseString) |
| 268 |
{ |
| 269 |
return TextData\CaseConvert::upper($mixedCaseString); |
| 270 |
} |
| 271 |
|
| 272 |
/** |
| 273 |
* PROPERCASE. |
| 274 |
* |
| 275 |
* Converts a string value to proper/title case. |
| 276 |
* |
| 277 |
* @deprecated 1.18.0 |
| 278 |
* Use the proper() method in the TextData\CaseConvert class instead |
| 279 |
* @see TextData\CaseConvert::proper() |
| 280 |
* |
| 281 |
* @param array|string $mixedCaseString |
| 282 |
* |
| 283 |
* @return array|string |
| 284 |
*/ |
| 285 |
public static function PROPERCASE($mixedCaseString) |
| 286 |
{ |
| 287 |
return TextData\CaseConvert::proper($mixedCaseString); |
| 288 |
} |
| 289 |
|
| 290 |
/** |
| 291 |
* REPLACE. |
| 292 |
* |
| 293 |
* @deprecated 1.18.0 |
| 294 |
* Use the replace() method in the TextData\Replace class instead |
| 295 |
* @see TextData\Replace::replace() |
| 296 |
* |
| 297 |
* @param string $oldText String to modify |
| 298 |
* @param int $start Start character |
| 299 |
* @param int $chars Number of characters |
| 300 |
* @param string $newText String to replace in defined position |
| 301 |
* |
| 302 |
* @return array|string |
| 303 |
*/ |
| 304 |
public static function REPLACE($oldText, $start, $chars, $newText) |
| 305 |
{ |
| 306 |
return TextData\Replace::replace($oldText, $start, $chars, $newText); |
| 307 |
} |
| 308 |
|
| 309 |
/** |
| 310 |
* SUBSTITUTE. |
| 311 |
* |
| 312 |
* @deprecated 1.18.0 |
| 313 |
* Use the substitute() method in the TextData\Replace class instead |
| 314 |
* @see TextData\Replace::substitute() |
| 315 |
* |
| 316 |
* @param string $text Value |
| 317 |
* @param string $fromText From Value |
| 318 |
* @param string $toText To Value |
| 319 |
* @param int $instance Instance Number |
| 320 |
* |
| 321 |
* @return array|string |
| 322 |
*/ |
| 323 |
public static function SUBSTITUTE($text = '', $fromText = '', $toText = '', $instance = 0) |
| 324 |
{ |
| 325 |
return TextData\Replace::substitute($text, $fromText, $toText, $instance); |
| 326 |
} |
| 327 |
|
| 328 |
/** |
| 329 |
* RETURNSTRING. |
| 330 |
* |
| 331 |
* @deprecated 1.18.0 |
| 332 |
* Use the test() method in the TextData\Text class instead |
| 333 |
* @see TextData\Text::test() |
| 334 |
* |
| 335 |
* @param mixed $testValue Value to check |
| 336 |
* |
| 337 |
* @return null|array|string |
| 338 |
*/ |
| 339 |
public static function RETURNSTRING($testValue = '') |
| 340 |
{ |
| 341 |
return TextData\Text::test($testValue); |
| 342 |
} |
| 343 |
|
| 344 |
/** |
| 345 |
* TEXTFORMAT. |
| 346 |
* |
| 347 |
* @deprecated 1.18.0 |
| 348 |
* Use the TEXTFORMAT() method in the TextData\Format class instead |
| 349 |
* @see TextData\Format::TEXTFORMAT() |
| 350 |
* |
| 351 |
* @param mixed $value Value to check |
| 352 |
* @param string $format Format mask to use |
| 353 |
* |
| 354 |
* @return array|string |
| 355 |
*/ |
| 356 |
public static function TEXTFORMAT($value, $format) |
| 357 |
{ |
| 358 |
return TextData\Format::TEXTFORMAT($value, $format); |
| 359 |
} |
| 360 |
|
| 361 |
/** |
| 362 |
* VALUE. |
| 363 |
* |
| 364 |
* @deprecated 1.18.0 |
| 365 |
* Use the VALUE() method in the TextData\Format class instead |
| 366 |
* @see TextData\Format::VALUE() |
| 367 |
* |
| 368 |
* @param mixed $value Value to check |
| 369 |
* |
| 370 |
* @return array|DateTimeInterface|float|int|string A string if arguments are invalid |
| 371 |
*/ |
| 372 |
public static function VALUE($value = '') |
| 373 |
{ |
| 374 |
return TextData\Format::VALUE($value); |
| 375 |
} |
| 376 |
|
| 377 |
/** |
| 378 |
* NUMBERVALUE. |
| 379 |
* |
| 380 |
* @deprecated 1.18.0 |
| 381 |
* Use the NUMBERVALUE() method in the TextData\Format class instead |
| 382 |
* @see TextData\Format::NUMBERVALUE() |
| 383 |
* |
| 384 |
* @param mixed $value Value to check |
| 385 |
* @param string $decimalSeparator decimal separator, defaults to locale defined value |
| 386 |
* @param string $groupSeparator group/thosands separator, defaults to locale defined value |
| 387 |
* |
| 388 |
* @return array|float|string |
| 389 |
*/ |
| 390 |
public static function NUMBERVALUE($value = '', $decimalSeparator = null, $groupSeparator = null) |
| 391 |
{ |
| 392 |
return TextData\Format::NUMBERVALUE($value, $decimalSeparator, $groupSeparator); |
| 393 |
} |
| 394 |
|
| 395 |
/** |
| 396 |
* Compares two text strings and returns TRUE if they are exactly the same, FALSE otherwise. |
| 397 |
* EXACT is case-sensitive but ignores formatting differences. |
| 398 |
* Use EXACT to test text being entered into a document. |
| 399 |
* |
| 400 |
* @deprecated 1.18.0 |
| 401 |
* Use the exact() method in the TextData\Text class instead |
| 402 |
* @see TextData\Text::exact() |
| 403 |
* |
| 404 |
* @param mixed $value1 |
| 405 |
* @param mixed $value2 |
| 406 |
* |
| 407 |
* @return array|bool |
| 408 |
*/ |
| 409 |
public static function EXACT($value1, $value2) |
| 410 |
{ |
| 411 |
return TextData\Text::exact($value1, $value2); |
| 412 |
} |
| 413 |
|
| 414 |
/** |
| 415 |
* TEXTJOIN. |
| 416 |
* |
| 417 |
* @deprecated 1.18.0 |
| 418 |
* Use the TEXTJOIN() method in the TextData\Concatenate class instead |
| 419 |
* @see TextData\Concatenate::TEXTJOIN() |
| 420 |
* |
| 421 |
* @param mixed $delimiter |
| 422 |
* @param mixed $ignoreEmpty |
| 423 |
* @param mixed $args |
| 424 |
* |
| 425 |
* @return array|string |
| 426 |
*/ |
| 427 |
public static function TEXTJOIN($delimiter, $ignoreEmpty, ...$args) |
| 428 |
{ |
| 429 |
return TextData\Concatenate::TEXTJOIN($delimiter, $ignoreEmpty, ...$args); |
| 430 |
} |
| 431 |
|
| 432 |
/** |
| 433 |
* REPT. |
| 434 |
* |
| 435 |
* Returns the result of builtin function repeat after validating args. |
| 436 |
* |
| 437 |
* @deprecated 1.18.0 |
| 438 |
* Use the builtinREPT() method in the TextData\Concatenate class instead |
| 439 |
* @see TextData\Concatenate::builtinREPT() |
| 440 |
* |
| 441 |
* @param array|string $str Should be numeric |
| 442 |
* @param mixed $number Should be int |
| 443 |
* |
| 444 |
* @return array|string |
| 445 |
*/ |
| 446 |
public static function builtinREPT($str, $number) |
| 447 |
{ |
| 448 |
return TextData\Concatenate::builtinREPT($str, $number); |
| 449 |
} |
| 450 |
} |
| 451 |
|