You are here

private static function PHPExcel_Calculation_Engineering::_nbrConversionFormat in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Engineering.php \PHPExcel_Calculation_Engineering::_nbrConversionFormat()

* Formats a number base string value with leading zeroes * *

Parameters

string $xVal The "number" to pad: * @param integer $places The length that we want to pad this value * @return string The padded "number"

9 calls to PHPExcel_Calculation_Engineering::_nbrConversionFormat()
PHPExcel_Calculation_Engineering::BINTOHEX in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Engineering.php
* BINTOHEX * * Return a binary value as hex. * * Excel Function: * BIN2HEX(x[,places]) * * @access public * @category Engineering Functions *
PHPExcel_Calculation_Engineering::BINTOOCT in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Engineering.php
* BINTOOCT * * Return a binary value as octal. * * Excel Function: * BIN2OCT(x[,places]) * * @access public * @category Engineering Functions *
PHPExcel_Calculation_Engineering::DECTOBIN in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Engineering.php
* DECTOBIN * * Return a decimal value as binary. * * Excel Function: * DEC2BIN(x[,places]) * * @access public * @category Engineering Functions *
PHPExcel_Calculation_Engineering::DECTOHEX in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Engineering.php
* DECTOHEX * * Return a decimal value as hex. * * Excel Function: * DEC2HEX(x[,places]) * * @access public * @category Engineering Functions *
PHPExcel_Calculation_Engineering::DECTOOCT in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Engineering.php
* DECTOOCT * * Return an decimal value as octal. * * Excel Function: * DEC2OCT(x[,places]) * * @access public * @category Engineering Functions *

... See full list

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Engineering.php, line 764

Class

PHPExcel_Calculation_Engineering
PHPExcel_Calculation_Engineering

Code

private static function _nbrConversionFormat($xVal, $places) {
  if (!is_null($places)) {
    if (strlen($xVal) <= $places) {
      return substr(str_pad($xVal, $places, '0', STR_PAD_LEFT), -10);
    }
    else {
      return PHPExcel_Calculation_Functions::NaN();
    }
  }
  return substr($xVal, -10);
}