docs: public final String collapseFrom(String s, char replacementCharacter) {
      final StringBuilder sb = new StringBuilder();
      boolean follows = false;
  
      for (int offset = 0; offset < s.length(); ) {
        final int codePoint = s.codePointAt(offset);
        if (matches(codePoint)) {
          if (!follows) {
            sb.append(replacementCharacter);
          }
          follows = true;
        } else {
          sb.appendCodePoint(codePoint);
          follows = false;
        }
        offset += Character.charCount(codePoint);
      }
  
      return sb.toString();
    }