Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com;
- import java.util.ResourceBundle;
- import java.util.StringTokenizer;
- public class Bundle {
- private static final ResourceBundle bundle = ResourceBundle.getBundle("bundle");
- private static final String delim = "${}";
- public static String property(String key) {
- String msg = bundle.getString(key);
- String prop = "";
- String str;
- StringTokenizer stringTokenizer = new StringTokenizer(msg, delim, true);
- while(stringTokenizer.hasMoreTokens()) {
- str = stringTokenizer.nextToken();
- if(str.equals("$")) {
- stringTokenizer.nextToken();
- str = stringTokenizer.nextToken();
- prop += Bundle.property(str);
- stringTokenizer.nextToken();
- } else {
- prop += str;
- }
- }
- return prop;
- }
- }
Add Comment
Please, Sign In to add comment