You are here

public static function PHPExcel_Calculation_TextData::MID in Loft Data Grids 6.2

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

* MID * *

Parameters

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

File

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

Class

PHPExcel_Calculation_TextData
PHPExcel_Calculation_TextData

Code

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