Java String Format getFormattedMessage(final String pattern, final Object[] arguments)

Here you can find the source of getFormattedMessage(final String pattern, final Object[] arguments)

Description

get Formatted Message

License

Open Source License

Declaration

public static String getFormattedMessage(final String pattern, final Object[] arguments) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2012 Martin Reiterer, Matthias Lettmayer.
 * 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
 * /*from   w w w  . ja v a2 s.com*/
 * Contributors:
 *     Martin Reiterer - initial API and implementation
 *     Matthias Lettmayer - added update marker utils to update and get right position of marker (fixed issue 8)
 *                        - fixed openEditor() to open an editor and selecting a key (fixed issue 59)
 ******************************************************************************/

import java.text.MessageFormat;

public class Main {
    public static String getFormattedMessage(final String pattern, final Object[] arguments) {
        String formattedMessage = "";

        final MessageFormat formatter = new MessageFormat(pattern);
        formattedMessage = formatter.format(arguments);

        return formattedMessage;
    }
}

Related

  1. getCodeFileName(String fileNameFormat, String randomCode)
  2. getDBPediaFormatDescriptions( String descriptionStr)
  3. getEmailFormatError(String fieldPropertyName)
  4. getFormat(String key, ResourceBundle bundle)
  5. getFormatted(String messageKey)
  6. getFormattedString(ResourceBundle b, String key, Object... params)
  7. getFormattedString(String key, Object arg)
  8. getFormattedString(String p_bundleName, String p_key, Locale p_locale, Object[] p_arguments)
  9. getFormatValue(String value, Object[] args)