Java String Format getFormattedString(String key, Object arg)

Here you can find the source of getFormattedString(String key, Object arg)

Description

get Formatted String

License

Open Source License

Declaration

public static String getFormattedString(String key, Object arg) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class Main {
    private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
            .getBundle("cucumber.eclipse.editor.<PropertiesFilename>");

    public static String getFormattedString(String key, Object arg) {
        return MessageFormat.format(getString(key), new Object[] { arg });
    }//from   w  w  w. ja  v  a2s. co m

    public static String getFormattedString(String key, Object[] args) {
        return MessageFormat.format(getString(key), args);
    }

    public static String getString(String key) {
        try {
            return RESOURCE_BUNDLE.getString(key);
        } catch (MissingResourceException localMissingResourceException) {
        }
        return '!' + key + '!';
    }
}

Related

  1. getEmailFormatError(String fieldPropertyName)
  2. getFormat(String key, ResourceBundle bundle)
  3. getFormatted(String messageKey)
  4. getFormattedMessage(final String pattern, final Object[] arguments)
  5. getFormattedString(ResourceBundle b, String key, Object... params)
  6. getFormattedString(String p_bundleName, String p_key, Locale p_locale, Object[] p_arguments)
  7. getFormatValue(String value, Object[] args)
  8. getImageWriter(ImageTypeSpecifier imageType, String imageFormatName)
  9. getImageWriter(String formatName)