Here you can find the source of fmtMsg(final String fmt, final String arg)
Parameter | Description |
---|---|
fmt | a parameter |
arg | a parameter |
public static String fmtMsg(final String fmt, final String arg)
//package com.java2s; /* ******************************************************************** Licensed to Jasig under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Jasig licenses this file to you 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://w w w .j a va 2 s .c o m http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import java.text.MessageFormat; public class Main { /** Format a message consisting of a format string * * @param fmt * @param arg * @return String formatted message */ public static String fmtMsg(final String fmt, final String arg) { Object[] o = new Object[1]; o[0] = arg; return MessageFormat.format(fmt, o); } /** Format a message consisting of a format string plus two string parameters * * @param fmt * @param arg1 * @param arg2 * @return String formatted message */ public static String fmtMsg(final String fmt, final String arg1, final String arg2) { Object[] o = new Object[2]; o[0] = arg1; o[1] = arg2; return MessageFormat.format(fmt, o); } /** Format a message consisting of a format string plus one integer parameter * * @param fmt * @param arg * @return String formatted message */ public static String fmtMsg(final String fmt, final int arg) { Object[] o = new Object[1]; o[0] = new Integer(arg); return MessageFormat.format(fmt, o); } }