Formats the given argument using the configured format template and locale.

@param arguments arguments to be formatted @ @return formatted result
506688
private String format( Object[] arguments )
    {
        Locale l = Locale.getDefault();
        if ( locale != null )
        {
            String[] parts = locale.split( "_", 3 );
            if ( parts.length <= 1 )
            {
                l = new Locale( locale );
            }
            else if ( parts.length == 2 )
            {
                l = new Locale( parts[0], parts[1] );
            }
            else
            {
                l = new Locale( parts[0], parts[1], parts[2] );
            }
        }

        return new MessageFormat( format, l ).format( arguments );
    }
169197
public static String format(final ResourceBundle bundle, final String key, final Object... arguments) {
		String pattern = ResourceBundles.getProperty(bundle, key);
		if (arguments.length == 0) {
			return pattern;
		}
		if (pattern.equals(key)) {
			return formatFallback(pattern, arguments);
		}
		return format(pattern, bundle.getLocale(), arguments);
	}
843384
String format(final String message, final Object[] arguments) {
		StringBuilder builder = new StringBuilder(INITIAL_STRING_BUFFER_CAPACITY);

		int argumentIndex = 0;
		int start = 0;
		int openingCurlyBrackets = 0;

		for (int index = 0; index < message.length(); ++index) {
			char character = message.charAt(index);
			if (character == '{') {
				if (openingCurlyBrackets++ == 0 && start < index) {
					builder.append(message, start, index);
					start = index;
				}
			} else if (character == '}' && openingCurlyBrackets > 0) {
				if (--openingCurlyBrackets == 0) {
					if (argumentIndex < arguments.length) {
						Object argument = arguments[argumentIndex++];
						if (argument instanceof Supplier) {
							argument = ((Supplier<?>) argument).get();
						}

						if (index == start + 1) {
							builder.append(argument);
						} else {
							builder.append(format(message.substring(start + 1, index), argument));
						}
					} else {
						builder.append(message, start, index + 1);
					}

					start = index + 1;
				}
			}
		}

		if (start < message.length()) {
			builder.append(message, start, message.length());
		}

		return builder.toString();
	}
967031
private function formatArguments($arguments)
    {
        return collect($arguments)->map(function ($argument) {
            return $argument instanceof Model ? FormatModel::given($argument) : $argument;
        })->toArray();
    }
1353575
public static String format(String format, Object... args) {
    return String.format(Locale.US, format, args);
  }
237068
public String format( String key, Object... params )
    {
        try
        {
            MessageFormat formatter = new MessageFormat( bundle.getString( key ) );
            return formatter.format( params );
        }
        catch (MissingResourceException ex)
        {
            return key;
        }
    }
169710
protected String format(String key, String defaultPattern, Object... args) {
        String escape = escape(defaultPattern);
        String s = lookupPattern(key, escape);
        Object[] objects = escapeAll(args);
        return MessageFormat.format(s, objects);
    }
123292
function format(str, ...args) {
  return !args.length ? str : str.replace(/%[a-zA-Z]/, (match) => args.shift() || match);
}
253606
public static String format(String templateMessage, Object... args) throws TechnicalException {
        if (null != templateMessage && countWildcardsOccurrences(templateMessage, "%s") == args.length) {
            try {
                return String.format(templateMessage, args);
            } catch (final Exception e) {
                throw new TechnicalException(getMessage(FAIL_MESSAGE_FORMAT_STRING), e);
            }
        } else {
            throw new TechnicalException(getMessage(FAIL_MESSAGE_FORMAT_STRING));
        }
    }
403678
public static String formatDistributions(List<Integer[]> distributions) {
    if (distributions.isEmpty()) {
      return null;
    }

    String[] distributionsFormatted = new String[distributions.size()];
    for (int i = 0; i < distributions.size(); i++) {
      if (distributions.get(i).length == 0) {
        distributionsFormatted[i] = "";
      } else {
        distributionsFormatted[i] = String.format(Locale.US, "%s,%s",
          TextUtils.formatCoordinate(distributions.get(i)[0]),
          TextUtils.formatCoordinate(distributions.get(i)[1]));
      }
    }
    return TextUtils.join(";", distributionsFormatted);
  }
1033903
public static String format(String str, Object... args) {
        str = str.replaceAll("\\{}", "%s");

        return String.format(str, args);
    }
38488
public Arguments processArgs(final String[] arguments) {
        useColor = getUseColor();

        final Map<String, Object> definedProps = new HashMap<>();
        final Deque<String> args = new ArrayDeque<>(Arrays.asList(arguments));
        while (!args.isEmpty()) {
            final String arg = args.pop();

            if (isLongForm(arg, "-help") || arg.equals("-h")) {
                justPrintUsage = true;
            } else if (isLongForm(arg, "-version")) {
                justPrintVersion = true;
            } else if (isLongForm(arg, "-plugins")) {
                justPrintPlugins = true;
            } else if (isLongForm(arg, "-transtypes")) {
                justPrintTranstypes = true;
            } else if (isLongForm(arg, "-deliverables")) {
                justPrintDeliverables = true;
            } else if (isLongForm(arg, "-install")) {
                handleArgInstall(arg, args);
            } else if (isLongForm(arg, "-project") || arg.equals("-p")) {
                handleArgProject(arg, args);
            } else if (isLongForm(arg, "-force")) {
                definedProps.put("force", "true");
            } else if (isLongForm(arg, "-uninstall")) {
                handleArgUninstall(arg, args);
            } else if (isLongForm(arg, "-diagnostics")) {
                justPrintDiagnostics = true;
            } else if (isLongForm(arg, "-verbose") || arg.equals("-v")) {
                msgOutputLevel = Project.MSG_INFO;
            } else if (isLongForm(arg, "-debug") || arg.equals("-d")) {
                msgOutputLevel = Project.MSG_VERBOSE;
            } else if (isLongForm(arg, "-noinput")) {
                allowInput = false;
            } else if (isLongForm(arg, "-logfile") || arg.equals("-l")) {
                handleArgLogFile(arg, args);
            } else if (isLongForm(arg, "-buildfile") || isLongForm(arg, "-file")) { //|| arg.equals("-f")
                handleArgBuildFile(args);
            } else if (isLongForm(arg, "-listener")) {
                handleArgListener(args);
            } else if (arg.startsWith("-D")) {
                handleArgDefine(arg, args);
            } else if (isLongForm(arg, "-logger")) {
                handleArgLogger(args);
            } else if (isLongForm(arg, "-inputhandler")) {
                handleArgInputHandler(args);
            } else if (isLongForm(arg, "-emacs") || arg.equals("-e")) {
                emacsMode = true;
            } else if (isLongForm(arg, "-propertyfile")) {
                handleArgPropertyFile(arg, args);
            } else if (arg.equals("-k") || isLongForm(arg, "-keep-going")) {
                keepGoingMode = true;
            } else if (isLongForm(arg, "-nice")) {
                handleArgNice(args);
            } else if (isLongForm(arg, "-input") || arg.equals("-i")) {
                handleArgInput(arg, args, ARGUMENTS.get(getArgumentName(arg)));
            } else if (ARGUMENTS.containsKey(getArgumentName(arg))) {
                definedProps.putAll(handleParameterArg(arg, args, ARGUMENTS.get(getArgumentName(arg))));
            } else if (getPluginArguments().containsKey(getArgumentName(arg))) {
                definedProps.putAll(handleParameterArg(arg, args, getPluginArguments().get(getArgumentName(arg))));
            } else if (LAUNCH_COMMANDS.contains(arg)) {
                // catch script/ant mismatch with a meaningful message
                // we could ignore it, but there are likely to be other
                // version problems, so we stamp down on the configuration now
                final String msg = "Ant's Main method is being handed " + "an option " + arg
                        + " that is only for the launcher class."
                        + "\nThis can be caused by a version mismatch between "
                        + "the ant script/.bat file and Ant itself.";
                throw new BuildException(msg);
            } else if (isLongForm(arg, "-autoproxy")) {
                proxy = true;
            } else if (arg.startsWith("-") || arg.startsWith("/")) {
                // we don't have any more args to recognize!
                throw new IllegalArgumentException(arg);
            } else {
                // if it's no other arg, it may be the target
                targets.addElement(arg);
            }
        }
        if (!inputs.isEmpty()) {
            definedProps.put("args.input", inputs.get(0));
        }

        if (install && msgOutputLevel < Project.MSG_INFO) {
            emacsMode = true;
        }

        definedProps.putAll(loadPropertyFiles());

        return new Arguments(useColor, msgOutputLevel, buildFile, install, installFile, projectFile, uninstallId,
                inputs, targets, listeners, propertyFiles, allowInput, keepGoingMode, loggerClassname,
                inputHandlerClassname, emacsMode, threadPriority, proxy, justPrintUsage, justPrintVersion,
                justPrintDiagnostics, justPrintPlugins, justPrintTranstypes, justPrintDeliverables, logFile,
                definedProps);
    }
1308624
public FtpMessage arguments(String arguments) {
        if (command != null) {
            command.setArguments(arguments);
        }

        setHeader(FtpMessageHeaders.FTP_ARGS, arguments);
        return this;
    }
545883
public synchronized String format(final String pattern, final Object... args) {
		Map<String, Object> model = Collections.emptyMap();
		ModelAdaptor modelAdaptor = new ModelAdaptor() {

			@Override
			public Object getValue(TemplateContext context, Token token, List<String> segments, String expression) {
				int index = Integer.parseInt(expression) - 1;
				return args[index];
			}

            @Override
            public Iterable<Object> getIterable(Object value) {
                return null;
            }

            @Override
            public String getSpecialIteratorVariable() {
                return null;
            }

        };

		String output = transformInternal(pattern, null, model, modelAdaptor, null);
		return output;
	}
341637
private static String format(String template, @javax.annotation.Nullable Object... args) {
    // If no arguments return the template.
    if (args == null) {
      return template;
    }

    // start substituting the arguments into the '%s' placeholders
    StringBuilder builder = new StringBuilder(template.length() + 16 * args.length);
    int templateStart = 0;
    int i = 0;
    while (i < args.length) {
      int placeholderStart = template.indexOf("%s", templateStart);
      if (placeholderStart == -1) {
        break;
      }
      builder.append(template, templateStart, placeholderStart);
      builder.append(args[i++]);
      templateStart = placeholderStart + 2;
    }
    builder.append(template, templateStart, template.length());

    // if we run out of placeholders, append the extra args in square braces
    if (i < args.length) {
      builder.append(" [");
      builder.append(args[i++]);
      while (i < args.length) {
        builder.append(", ");
        builder.append(args[i++]);
      }
      builder.append(']');
    }

    return builder.toString();
  }
276386
public String formatMessage(String key, Object[] args) {
        String msg = internalFormatMessage(getMessage(key), args);
        return msg;
    }
977644
protected String getArguments(Object[] args) {

        if (args == null || args.length == 0) {
            return "";
        }

        StringBuilder sb = new StringBuilder();

        if (args.length == 1) {
            Object arg = args[0];
            String param = getSingleArgParameterAsString(arg);
            String displayParam = getSingleArgDisplayParameter(param);
            if (arg instanceof String) {
                sb.append("\"");
                sb.append(displayParam);
                sb.append("\"");
            } else {
                sb.append(displayParam);
            }
        } else {
            for (int i = 0; i < args.length; i++) {
                Object arg = args[i];
                boolean lastArg = i == args.length - 1;
                String param = getParameterAsString(arg);
                String displayParam = getDisplayParameter(param);
                if (arg instanceof String) {
                    sb.append("\"");
                    sb.append(displayParam);
                    sb.append("\"");
                } else {
                    sb.append(displayParam);
                }

                if (!lastArg) {
                    sb.append(",");
                }
            }
        }

        return sb.toString();
    }