Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

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