mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-26 01:15:44 +00:00
Minor performance tweaks and adjustments to Excel functions to handle a few envelope test cases
git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@85742 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
@@ -703,4 +703,18 @@ class PHPExcel_Shared_String
|
||||
return $pValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
*
|
||||
* @param string $value
|
||||
* @return mixed string or only the leading numeric part of the string
|
||||
*/
|
||||
public static function testStringAsNumeric($value)
|
||||
{
|
||||
if (is_numeric($value))
|
||||
return $value;
|
||||
$v = floatval($value);
|
||||
return (is_numeric(substr($value,0,strlen($v)))) ? $v : $value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user