- Timestamp:
- 2016-04-20T22:50:52+12:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/Dictionary.java
r26257 r30477 140 140 } 141 141 142 public static String processArgs(String initial, String args[]) 143 { 144 // If the string contains arguments we have to insert them. 145 StringBuffer complete = new StringBuffer(); 146 // While we still have initial string left. 147 while (initial.length() > 0 && initial.indexOf('{') != -1 && initial.indexOf('}') != -1) 148 { 149 // Remove preamble 150 int opening = initial.indexOf('{'); 151 int closing = initial.indexOf('}'); 152 int comment_mark = initial.indexOf('-', opening); // May not exist 153 if (comment_mark > closing) 154 { // May also be detecting a later comment 155 comment_mark = -1; 156 } 157 complete.append(initial.substring(0, opening)); 158 159 // Parse arg_num 160 String arg_str = null; 161 if (comment_mark != -1) 162 { 163 arg_str = initial.substring(opening + 1, comment_mark); 164 } 165 else 166 { 167 arg_str = initial.substring(opening + 1, closing); 168 } 169 if (closing + 1 < initial.length()) 170 { 171 initial = initial.substring(closing + 1); 172 } 173 else 174 { 175 initial = ""; 176 } 177 int arg_num = Integer.parseInt(arg_str); 178 // Insert argument 179 if (args != null && 0 <= arg_num && arg_num < args.length) 180 { 181 complete.append(args[arg_num]); 182 } 183 } 184 complete.append(initial); 185 return complete.toString(); 186 } 187 142 188 /** 143 189 * Used to retrieve a property value from the Locale specific … … 162 208 public String get(String key, String args[]) 163 209 { 210 // The following 'argsStr' doesn't appear to be used in rest of method, so 211 // commenting out 212 /* 164 213 String argsStr = ""; 165 214 if (args != null) … … 170 219 } 171 220 } 172 221 */ 222 173 223 if (this.raw == null) 174 224 { … … 186 236 return initial; 187 237 } 238 239 return processArgs(initial,args); 240 /* 188 241 // If the string contains arguments we have to insert them. 189 242 StringBuffer complete = new StringBuffer(); … … 228 281 complete.append(initial); 229 282 return complete.toString(); 283 */ 230 284 } 231 285 catch (Exception e)
Note:
See TracChangeset
for help on using the changeset viewer.