No internet connection
  1. Home

Comments for https://horstmann.com/unblog/2023-10-03/index.html

By System @system
    2024-09-30 18:27:29.661Z
    • 2 comments
    1. G
      Con Cunningham @Greycon
        2024-09-30 18:27:29.805Z

        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

        1. CCay Horstmann @cayhorstmann
            2024-09-30 19:20:53.416Z

            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.)