Java Message Format formatString(String format, String arg1)

Here you can find the source of formatString(String format, String arg1)

Description

Convenience formatting methods.

License

Open Source License

Declaration

public static String formatString(String format, String arg1) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2005, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/*from   ww  w.  j a  v a 2s .co  m*/
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

import java.text.MessageFormat;

public class Main {
    /**
     * Convenience formatting methods.
     */
    public static String formatString(String format, String arg1) {
        return MessageFormat.format(format, new Object[] { arg1 });
    }

    public static String formatString(String format, String arg1, String arg2) {
        return MessageFormat.format(format, new Object[] { arg1, arg2 });
    }
}

Related

  1. formatMessage(String message, Object param1)
  2. formatMessage(String message, Object... args)
  3. formatResource(Object[] info, String require)
  4. formats(String pattern, Object... args)
  5. formatString(ResourceBundle resourceBundle, String key, Object data)
  6. formatString(String message, Object... args)
  7. formatString(String str, String pattern)