You are here

public static function PHPExcel_Shared_String::testStringAsNumeric in Loft Data Grids 7.2

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

* Retrieve any leading numeric part of a string, or return the full string if no leading numeric * (handles basic integer or float, but not exponent or non decimal) * *

Parameters

string $value: * @return mixed string or only the leading numeric part of the string

1 call to PHPExcel_Shared_String::testStringAsNumeric()
PHPExcel_Calculation_DateTime::DATE in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/DateTime.php
* DATE * * The DATE function returns a value that represents a particular date. * * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date * format of your regional settings. PHPExcel does not change…

File

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

Class

PHPExcel_Shared_String
PHPExcel_Shared_String

Code

public static function testStringAsNumeric($value) {
  if (is_numeric($value)) {
    return $value;
  }
  $v = floatval($value);
  return is_numeric(substr($value, 0, strlen($v))) ? $v : $value;
}