diff --git a/Classes/PHPExcel/Calculation/TextData.php b/Classes/PHPExcel/Calculation/TextData.php index 7a52d2e..148a5b7 100644 --- a/Classes/PHPExcel/Calculation/TextData.php +++ b/Classes/PHPExcel/Calculation/TextData.php @@ -118,13 +118,12 @@ class PHPExcel_Calculation_TextData { */ public static function TRIMSPACES($stringValue = '') { $stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue); - if (is_bool($stringValue)) { return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } if (is_string($stringValue) || is_numeric($stringValue)) { - return trim(preg_replace('/ +/',' ',trim($stringValue,' '))); + return trim(preg_replace('/ +/',' ',trim($stringValue, ' ')), ' '); } return NULL; } // function TRIMSPACES() diff --git a/unitTests/rawTestData/Calculation/TextData/TRIM.data b/unitTests/rawTestData/Calculation/TextData/TRIM.data index ea1bd05..ea80096 100644 --- a/unitTests/rawTestData/Calculation/TextData/TRIM.data +++ b/unitTests/rawTestData/Calculation/TextData/TRIM.data @@ -1,6 +1,6 @@ "HELLO ", "HELLO" " HELLO", "HELLO" -" HELLO ", "HELLO" +" HELLO ", "HELLO" " HELLO", " HELLO" "HELLO WORLD", "HELLO WORLD" TRUE, "TRUE"