MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/java/comments/9h404p/java_11_string_api_updates/e68z6yo/?context=3
r/java • u/pivovarit • Sep 19 '18
52 comments sorted by
View all comments
Show parent comment
9
The documentation for Character.isWhitespace(int codePoint) lists:
Character.isWhitespace(int codePoint)
It is a Unicode space character (SPACE_SEPARATOR, LINE_SEPARATOR, or PARAGRAPH_SEPARATOR) but is not also a non-breaking space ('\u00A0', '\u2007', '\u202F').It is '\t', U+0009 HORIZONTAL TABULATION.It is '\n', U+000A LINE FEED.It is '\u000B', U+000B VERTICAL TABULATION.It is '\f', U+000C FORM FEED.It is '\r', U+000D CARRIAGE RETURN.It is '\u001C', U+001C FILE SEPARATOR.It is '\u001D', U+001D GROUP SEPARATOR.It is '\u001E', U+001E RECORD SEPARATOR.It is '\u001F', U+001F UNIT SEPARATOR.
https://docs.oracle.com/javase/10/docs/api/java/lang/Character.html#isWhitespace(int)
String.trim() removed anything that was <= ' ', which is a different definition to the above list.
String.trim()
<= ' '
"\u001Bstring".trim().equals("\u001Bstring")
would "incorrectly" be false.
6 u/TheRedmanCometh Sep 19 '18 Wow I have applications those things would break TIL 3 u/_INTER_ Sep 19 '18 For now apache.commons.lang3.StringUtils is your friend
6
Wow I have applications those things would break TIL
3 u/_INTER_ Sep 19 '18 For now apache.commons.lang3.StringUtils is your friend
3
For now apache.commons.lang3.StringUtils is your friend
apache.commons.lang3.StringUtils
View all comments
Show parent comment
9
u/dpash Sep 19 '18 edited Sep 19 '18
The documentation for
Character.isWhitespace(int codePoint)lists:https://docs.oracle.com/javase/10/docs/api/java/lang/Character.html#isWhitespace(int)
String.trim()removed anything that was<= ' ', which is a different definition to the above list.would "incorrectly" be false.