Formats a messages containing {0}, {1}... etc. Used for translation.
@param msg a message with placeholders
@param params objects used to populate the placeholders
@return a formatted message
557932
public static String formatMessage(String msg, Object... params) {
		try {
			// required by MessageFormat, single quotes break string interpolation!
			msg = StringUtils.replace(msg, "'", "''");
			return StringUtils.isBlank(msg) ? "" : MessageFormat.format(msg, params);
		} catch (IllegalArgumentException e) {
			return msg;
		}
	}
773803
private String format(String message, Object[] params) {
        if (params.length == 0) {
            return message;
        } else if (params.length == 1 && params[0] instanceof Throwable) {
            // We print only the message here since breaking exception will bubble up
            // anyway
            return message + ": " + params[0].toString();
        } else {
            return String.format(message, params);
        }
    }
1178912
@Override
    public Message newMessage(final String message, final Object... params) {
        return new FormattedMessage(message, params);
    }
1077751
protected final String exceptionMessage(String msg) {
        if (msg == null) {
            msg = "";
        }

        StringBuilder buf = new StringBuilder(128 + msg.length())
            .append(protocol())
            .append(", ")
            .append(authScheme())
            .append(", ")
            .append(proxyAddress)
            .append(" => ")
            .append(destinationAddress);
        if (!msg.isEmpty()) {
            buf.append(", ").append(msg);
        }

        return buf.toString();
    }
312417
public String getMessage()
    {
        String.format("Wrong Syntax for [%s]: %s", name,message);
        return  String.format("Wrong Syntax for [%s]: %s", name,message);
    }
222709
function messageFormat (type, inspect) {
  var msg = this.detailed
    ? 'expect %s `%s`, but %s `%s` given'
    : 'expect `%s`, but `%s` given'
  return this.detailed
    ? util.format(msg, type.expected, inspect.expected, type.actual, inspect.actual)
    : util.format(msg, type.expected, type.actual)
}
1142945
function MessageFormat(message, locales, formats) {
  // Parse string messages into an AST.
  var ast = typeof message === 'string' ? MessageFormat.__parse(message) : message;

  if (!(ast && ast.type === 'messageFormatPattern')) {
    throw new TypeError('A message must be provided as a String or AST.');
  } // Creates a new object with the specified `formats` merged with the default
  // formats.


  formats = this._mergeFormats(MessageFormat.formats, formats); // Defined first because it's used to build the format pattern.

  defineProperty(this, '_locale', {
    value: this._resolveLocale(locales)
  }); // Compile the `ast` to a pattern that is highly optimized for repeated
  // `format()` invocations. **Note:** This passes the `locales` set provided
  // to the constructor instead of just the resolved locale.

  var pluralFn = this._findPluralRuleFunction(this._locale);

  var pattern = this._compilePattern(ast, locales, formats, pluralFn); // "Bind" `format()` method to `this` so it can be passed by reference like
  // the other `Intl` APIs.


  var messageFormat = this;

  this.format = function (values) {
    try {
      return messageFormat._format(pattern, values);
    } catch (e) {
      if (e.variableId) {
        throw new Error('The intl string context variable \'' + e.variableId + '\'' + ' was not provided to the string \'' + message + '\'');
      } else {
        throw e;
      }
    }
  };
}
485094
public static final String format(final String format, final Object... params)
    {
        final StringBuilder b = new StringBuilder();

        int p = 0;

        while (true)
        {
            final int i = format.indexOf('{', p);

            if (i == -1)
            {
                break;// done
            }
            final int i2 = format.indexOf('}', i + 1);

            if (i2 == -1)
            {
                break;// done
            }
            if (p != i)
            {
                b.append(format.substring(p, i));
            }
            final String nstr = format.substring(i + 1, i2);

            try
            {
                final int n = Integer.parseInt(nstr);

                if ((n >= 0) && (n < params.length))
                {
                    b.append(params[n]);
                }
                else
                {
                    b.append('{').append(nstr).append('}');
                }
            }
            catch (final NumberFormatException e)
            {
                b.append('{').append(nstr).append('}');
            }
            p = i2 + 1;
        }
        b.append(format.substring(p));

        return b.toString();
    }
1074439
public static String formatParamList(String ... params) {
		StringBuilder s = new StringBuilder();
		for(String p : params) {
			if (s.length() != 0) {
				s.append(", ");
			}
			s.append(p);
		}
		return s.toString();
	}
101388
@Trivial
    public static final String getMessage(String key, Object... params) {
        return TraceNLS.getFormattedMessage(Utils.class, tc.getResourceBundleName(), key, params, key);
    }
26618
private List<HashMap<String, String>> createSegmentListFromMessage(String msg) {
        List<HashMap<String, String>> segmentList = new ArrayList<HashMap<String, String>>();

        boolean quoteNext = false;
        int startPosi = 0;

        for (int i = 0; i < msg.length(); i++) {
            char ch = msg.charAt(i);

            if (!quoteNext && ch == '@') {
                // skip binary values
                int idx = msg.indexOf("@", i + 1);
                String len_st = msg.substring(i + 1, idx);
                i += Integer.parseInt(len_st) + 1 + len_st.length();
            } else if (!quoteNext && ch == '\'') {
                // segment-ende gefunden
                HashMap<String, String> segmentInfo = new HashMap<>();
                segmentInfo.put("code", msg.substring(startPosi, msg.indexOf(":", startPosi)));
                segmentInfo.put("start", Integer.toString(startPosi));
                segmentInfo.put("length", Integer.toString(i - startPosi + 1));

                segmentList.add(segmentInfo);
                startPosi = i + 1;
            }
            quoteNext = !quoteNext && ch == '?';
        }

        return segmentList;
    }
237768
private function formatMessage(string $message, array $params): string
    {
        $params = \array_values($params);
        \array_unshift($params, $message);
        
        return \sprintf(...$params);
    }
1087152
public static String formatMessage(TraceComponent tc, Locale locale, String msgKey, Object... objs) {
        return formatMessage(tc, (locale == null) ? null : Collections.singletonList(locale), msgKey, objs);
    }
538432
protected static List<String> formatMessageParameters(Object[] parameters) {
        List<String> stringParameters = new ArrayList<>(parameters.length);
        for (Object parameter : parameters) {
            stringParameters.add((parameter != null) ? parameter.toString() : null);
        }
        return stringParameters;
    }
1030391
public static String concat(Object... msg) {
		StringBuffer b = new StringBuffer();
		for (Object string : msg) {
			if (string != null) {
				b.append(JKObjectUtil.toString(string, true));
				b.append(" ");
			}
		}
		return b.toString();
	}
50792
public static String format(final String value, String... params) {
        validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
        Pattern p = Pattern.compile("\\{(\\w+)}");
        Matcher m = p.matcher(value);
        String result = value;
        while (m.find()) {
            int paramNumber = Integer.parseInt(m.group(1));
            if (params == null || paramNumber >= params.length) {
                throw new IllegalArgumentException("params does not have value for " + m.group());
            }
            result = result.replace(m.group(), params[paramNumber]);
        }
        return result;
    }
1212515
static public String getString(String msg, Object[] args)
	{
		String format = msg;

		if (bundle != null)
		{
			try
			{
				format = bundle.getString(msg);
			}
			catch (MissingResourceException e)
			{
			}
		}

		return format(format, args);
	}