code: private static int countAnchors(String formatString) {
          Matcher m = FORMATTER_ANCHOR.matcher(formatString);
          int count = 0;
          int start = 0;
          while (m.find(start)) {
              ++count;
              start = m.end();
          }
  
          return count;
      }
docs: returns the number of anchors {} in a string
  
  @param formatString
  the format string
  @return the number of anchors