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:
Mark Baker
2012-01-25 22:07:35 +00:00
parent a77c44d4e6
commit 2cce9b754d
16 changed files with 137 additions and 92 deletions
+14
View File
@@ -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;
}
}