Re: TRIM function issue

2021-03-16 Thread Nick Burch

On Tue, 16 Mar 2021, Emil Elmarsson wrote:
I'm not sure where to contact you or if you have an issue tracker 
somewhere, so tell me if I should ask this question somewhere else.


Apache POI uses Bugzilla for issue tracking:
https://bz.apache.org/bugzilla/describecomponents.cgi?product=POI


I was wondering why your implementation of the Excel TRIM function doesn't
remove extra whitespace, but rather only removes leading and trailing
whitespace like Java's trim function.


Probably because it's implemented with the Java trim function! :)
https://github.com/apache/poi/blob/trunk/src/java/org/apache/poi/ss/formula/functions/TextFunction.java#L153


Excel: TRIM(" a   b ") -> "a b" (3 characters)
Java: String a = " a   b ".trim(); -> "a   b" (5 characters)


If you're able to work up a fix for this, ideally with a unit test that 
shows the issue (possibly by adding a few more cells into the TRIM rows in 
test-data/spreadsheet/FormulaEvalTestData.xls ?), that'd be great!


Nick

-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



TRIM function issue

2021-03-16 Thread Emil Elmarsson
Hello,

I'm not sure where to contact you or if you have an issue tracker
somewhere, so tell me if I should ask this question somewhere else.

I was wondering why your implementation of the Excel TRIM function doesn't
remove extra whitespace, but rather only removes leading and trailing
whitespace like Java's trim function.

Excel: TRIM(" a   b ") -> "a b" (3 characters)
Java: String a = " a   b ".trim(); -> "a   b" (5 characters)

-- 
Emil Elmarsson
Molnify

molnify.com 
linkedin.com/company/molnify 
facebook.com/molnifyapps 
youtube.com/c/molnify 

Surbrunnsgatan 16 | 114 27 Stockholm | Sweden
+46 (0)76 790 10 44 | emil.elmars...@molnify.com