code: public static String format(String pattern, Object args, boolean preserve) {
          StringBuilder sb = null;
          int top = 0;
          Matcher matcher = PARAM_SYNTAX.matcher(pattern);
  
          if (matcher.find()) {
              sb = new StringBuilder();
              Class<?> type = args.getClass();
              do {
                  try {
                      Object value = Beans.getKnownField(type, substringAfter(matcher.group(1), '.')).get(args);
                      if (preserve) {
                          sb.append(pattern.substring(top, matcher.end() - 1)).append(':').append(value);
                          top = matcher.end() - 1;
                      } else {
                          sb.append(pattern.substring(top, matcher.start())).append(value);
                          top = matcher.end();
                      }
                  } catch (Exception x) {
                      //throw new IllegalArgumentException("Translation format specification", x);
                      // no value in args that matches the parameter
                  }
              } while (matcher.find());
          }
  
          return (sb == null) ? pattern : sb.append(pattern.substring(top)).toString();
      }
docs: Returns a formatted string using the specified format string and object fields.
  <ol>
  <li> Parameter names in the format string are enclosed between '{' and '}'</li>
  <li> After formatting, each value is added between a parameter name and the closing brace
  </ol>
  
  @param pattern - a string pattern with embedded placeholders
  @param args - an object to provide arguments
  @param preserve - preserves original parameter marks
  @return the formatted string