You are here

public static function PHPExcel_Shared_String::convertToNumberIfFraction in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/String.php \PHPExcel_Shared_String::convertToNumberIfFraction()

* Identify whether a string contains a fractional numeric value, * and convert it to a numeric if it is * *

Parameters

string &$operand string value to test: * @return boolean

6 calls to PHPExcel_Shared_String::convertToNumberIfFraction()
PHPExcel_Calculation::_validateBinaryOperand in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation.php
PHPExcel_Shared_JAMA_Matrix::arrayRightDivide in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/JAMA/Matrix.php
* arrayRightDivide * * Element-by-element right division * A / B *
PHPExcel_Shared_JAMA_Matrix::arrayTimesEquals in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/JAMA/Matrix.php
* arrayTimesEquals * * Element-by-element multiplication * Aij = Aij * Bij *
PHPExcel_Shared_JAMA_Matrix::minusEquals in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/JAMA/Matrix.php
* minusEquals * * A = A - B *
PHPExcel_Shared_JAMA_Matrix::plusEquals in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/JAMA/Matrix.php
* plusEquals * * A = A + B *

... See full list

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/String.php, line 671

Class

PHPExcel_Shared_String
PHPExcel_Shared_String

Code

public static function convertToNumberIfFraction(&$operand) {
  if (preg_match('/^' . self::STRING_REGEXP_FRACTION . '$/i', $operand, $match)) {
    $sign = $match[1] == '-' ? '-' : '+';
    $fractionFormula = '=' . $sign . $match[2] . $sign . $match[3];
    $operand = PHPExcel_Calculation::getInstance()
      ->_calculateFormulaValue($fractionFormula);
    return true;
  }
  return false;
}