List of utility methods to do String Format
String | format(String str, String obj) format if (str == null || obj == null) return str; return replace(str, "{0}", obj); |
String | format(String str, String[] obj) format if (str == null || obj == null) return str; for (int i = 0; i < obj.length; i++) str = replace(str, "{" + i + "}", obj[i]); return str; |
String | format(String str, Object... obj) format if (str == null || obj == null) return str; for (int i = 0; i < obj.length; i++) str = replace(str, "{" + i + "}", String.valueOf(obj[i])); return str; |
String | format(String str, Object... args) format if (isEmpty(str)) return ""; if (args.length == 0) return str; String result = str; Pattern p = java.util.regex.Pattern.compile("\\{(\\d+)\\}"); Matcher m = p.matcher(str); while (m.find()) { ... |
String | simpleFormat(String s, Object aobj[]) simple Format String as[] = s.split("%s"); String s1; if (as.length < 2) { s1 = s; } else { StringBuilder stringbuilder = new StringBuilder(); int i = aobj.length; int j = 0; ... |
String | format(String str, Object... args) format if (isEmptyOrNull(str)) return ""; if (args.length == 0) return str; String result = str; Pattern p = java.util.regex.Pattern.compile("\\{(\\d+)\\}"); Matcher m = p.matcher(str); while (m.find()) { ... |
String | formatAccountNo(String accountNo) format Account No try { StringBuffer s = new StringBuffer(); for (int i = 0; i < accountNo.length() - 10; i++) { s.append("*"); StringBuffer sb = new StringBuffer(accountNo); sb.replace(6, accountNo.length() - 4, s.toString()); return sb.toString(); ... |
String | formattedNumber(String number) formatted Number if (number == null) return "0"; String fn = "0"; if (isNumber(number)) { DecimalFormat df = new DecimalFormat("#,##0"); fn = df.format(Double.parseDouble(number)); return fn; ... |
CharSequence | currentTime(CharSequence inFormat) current Time return DateFormat.format(inFormat, System.currentTimeMillis());
|
String | formatIndent(String whiteSpace) Formats the indent so that it uses as many tabs as possible int tabs, spaces, newTabs; char chTemp; String strTemp, ret; tabs = 0; spaces = 0; newTabs = 0; ret = ""; for (int i = 0; i < whiteSpace.length(); i++) { ... |