简体   繁体   中英

What's the difference between BREAKING_WHITESPACE and WHITESPACE in Guava CharMatcher

In guava CharMatcher there are 2 inner class BREAKING_WHITESPACE and WHITESPACE, and the definition of BREAKING_WHITESPACE is : a whitespace which can be interpreted as a break between words for formatting purposes

What does it mean?

Can anyone answer this question ?

If you can provide an example for the diff it would be nice

Thx in advance

This is fairly general character stuff, not Guava specific:
http://en.wikipedia.org/wiki/Non-breaking_space#Non-breaking_behavior
Actually the Javadoc says it all:

Determines whether a character is a breaking whitespace (that is, a whitespace which can be interpreted as a break between words for formatting purposes).

You put a non-breaking space in text between two words which must stay on the same line. Often it gets used for numbers with units like 123.456 MPa . In HTML you'd write   , ever seen it?

Out of all whitespace chars , there are some non-breaking, eg U+0202F and U+000A0 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM