Code example for ResourceBundle

Methods: getString

0
	private Messages() { 
	} 
 
	public static String getString(String key) {
		try { 
			return RESOURCE_BUNDLE.getString(key);
		} catch (MissingResourceException e) {
			return '!' + key + '!';
		} 
	} 
	 
	public static String getString(String key, String... args) {
		try { 
			String message=RESOURCE_BUNDLE.getString(key);
			 
			for (int i=1;i<=args.length;i++) {
				String arg=args[i-1];
				if (arg!=null ) {
					String placeHolder="{"+i+"}";				
					int index=message.indexOf(placeHolder);
					if (index>=0) {