You are here

public static function PHPExcel_Calculation_TextData::RIGHT in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/TextData.php \PHPExcel_Calculation_TextData::RIGHT()

* RIGHT * *

Parameters

string $value Value: * @param int $chars Number of characters * @return string

1 call to PHPExcel_Calculation_TextData::RIGHT()
PHPExcel_Calculation_TextData::REPLACE in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/TextData.php
* REPLACE * *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/TextData.php, line 388

Class

PHPExcel_Calculation_TextData
PHPExcel_Calculation_TextData

Code

public static function RIGHT($value = '', $chars = 1) {
  $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
  $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
  if ($chars < 0) {
    return PHPExcel_Calculation_Functions::VALUE();
  }
  if (is_bool($value)) {
    $value = $value ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
  }
  if (function_exists('mb_substr') && function_exists('mb_strlen')) {
    return mb_substr($value, mb_strlen($value, 'UTF-8') - $chars, $chars, 'UTF-8');
  }
  else {
    return substr($value, strlen($value) - $chars);
  }
}