Excel TRIM function only trims spaces, not tabs or other spacing characters
This commit is contained in:
parent
fb18b7b598
commit
976e7f064a
|
@ -118,13 +118,12 @@ class PHPExcel_Calculation_TextData {
|
||||||
*/
|
*/
|
||||||
public static function TRIMSPACES($stringValue = '') {
|
public static function TRIMSPACES($stringValue = '') {
|
||||||
$stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue);
|
$stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue);
|
||||||
|
|
||||||
if (is_bool($stringValue)) {
|
if (is_bool($stringValue)) {
|
||||||
return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_string($stringValue) || is_numeric($stringValue)) {
|
if (is_string($stringValue) || is_numeric($stringValue)) {
|
||||||
return trim(preg_replace('/ +/',' ',trim($stringValue,' ')));
|
return trim(preg_replace('/ +/',' ',trim($stringValue, ' ')), ' ');
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
} // function TRIMSPACES()
|
} // function TRIMSPACES()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"HELLO ", "HELLO"
|
"HELLO ", "HELLO"
|
||||||
" HELLO", "HELLO"
|
" HELLO", "HELLO"
|
||||||
" HELLO ", "HELLO"
|
" HELLO ", "HELLO"
|
||||||
" HELLO", " HELLO"
|
" HELLO", " HELLO"
|
||||||
"HELLO WORLD", "HELLO WORLD"
|
"HELLO WORLD", "HELLO WORLD"
|
||||||
TRUE, "TRUE"
|
TRUE, "TRUE"
|
||||||
|
|
Loading…
Reference in New Issue