Here you can find the source of formatString(String message, Object... args)
Parameter | Description |
---|---|
message | the message |
args | the args |
Parameter | Description |
---|---|
IllegalArgumentException | the illegal argument exception |
public static String formatString(String message, Object... args) throws IllegalArgumentException
//package com.java2s; /******************************************************************************* * Copyright (c) 2006-2010 eBay Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 *******************************************************************************/ import java.text.MessageFormat; public class Main { /**/*from w w w.java 2s .c o m*/ * Format the given message with the provided arguments. * * @param message the message * @param args the args * @return the string * @throws IllegalArgumentException the illegal argument exception * @see java.text.MessageFormat */ public static String formatString(String message, Object... args) throws IllegalArgumentException { if (args == null) return message; return MessageFormat.format(message, args); } }