Comments for https://horstmann.com/unblog/2023-10-03/index.html
By System @system
Comments for: https://horstmann.com/unblog/2023-10-03/index.html
- GCon Cunningham @Greycon
Hi Cay - just took delivery of 13th Edition , Volume 2. Question - What exactly is the meaning of the regex used in split("\b{g}") - I know the b is a bounary, but I can't find the {g} anyplace. It always seems to be used for a numerical repeat value. Thanks for all the work! Con
- CCay Horstmann @cayhorstmann
Hi, that's a grapheme cluster boundary. See the last group in Table 2.12.
Splitting along grapheme cluster boundaries breaks a string into what humans perceive as the constituent characters:
"Ciao 🇮🇹".split("\b{g}") // An array with the six elements "C", "i", "a", "o", " ", "🇮🇹"
(The Italian flag actually uses two Unicde characters.)