Here you can find the source of format(String str, int replacement)
Parameter | Description |
---|---|
str | a parameter |
replacement | a parameter |
public static String format(String str, int replacement)
//package com.java2s; /**//from w w w. ja v a 2s. com * Aptana Studio * Copyright (c) 2005-2012 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the GNU Public License (GPL) v3 (with exceptions). * Please see the license.html included with this distribution for details. * Any modifications to this file must keep this entire header intact. */ import java.text.MessageFormat; public class Main { /** * Formats the string with replacement values * * @param str * @param replacement * @return String */ public static String format(String str, int replacement) { return MessageFormat.format(str, new Object[] { Integer.toString(replacement) }); } /** * Formats the string with replacement values * * @param str * @param replacement * @return String */ public static String format(String str, long replacement) { return MessageFormat.format(str, new Object[] { Long.toString(replacement) }); } /** * Formats the string with replacement values * * @param str * @param replacement * @return String */ public static String format(String str, Object replacement) { return MessageFormat.format(str, new Object[] { replacement.toString() }); } /** * Formats the string with replacement values * * @param str * @param replacements * @return String */ public static String format(String str, Object[] replacements) { return MessageFormat.format(str, replacements); } /** * Formats the string with replacement values * * @param str * @param replacement * @return String */ public static String format(String str, String replacement) { return MessageFormat.format(str, new Object[] { replacement }); } }