List of utility methods to do Formatter Usage
String | format_mm_ss(final long time) formamss _sbFormatter.setLength(0); if (time < 0) { _sbFormatter.append(SYMBOL_DASH); final long timeAbsolute = time < 0 ? 0 - time : time; return _formatter.format(FORMAT_MM_SS, (timeAbsolute / 60), (timeAbsolute % 60)).toString(); |
String | formatLong(long number, int length) format Long StringBuffer sb = new StringBuffer(); Formatter f = new Formatter(sb); f.format("%,d", number); return padLeft(sb.toString(), length); |
Exception | formatMessageException(String format, Object... args) format Message Exception StringBuilder mes = new StringBuilder(); Formatter f = new Formatter(mes); f.format(format, args); f.close(); return new Exception(mes.toString()); |
String | formatNumber(int number) This returns a formatted string that shows the number based on the locale turns 1000 into 1,000 StringBuilder str = new StringBuilder(); Formatter f = new Formatter(str, Locale.getDefault()); f.format("%,d", number); return str.toString(); |
void | formatResponse(Formatter formatter, String response) format Response formatter.format(" > %100s <\n", response);
|
String | formatTzname(final String format, final String letter) format Tzname if (!format.contains("%")) { return format; final Formatter f = new Formatter(); final String param; if (letter.equals("-")) { param = ""; } else { ... |
String | formatv(String format, Object[] args) Returns a string from a format string and its argument. if (args == null || args.length == 0) return format; synchronized (g_formatter) { g_formatter.format(format, args); g_formatter.flush(); StringBuilder s = (StringBuilder) (g_formatter.out()); String ans = s.toString(); s.delete(0, s.length()); ... |
String | formatZeroDecimals(Number x) format Zero Decimals return new Formatter().format("%,.0f", x == null ? Double.NaN : x.doubleValue()).toString(); |
String | fperfdata(String label, double val, String uom, int warnp, double warn, int critp, double crit, boolean minp, double minv, boolean maxp, double maxv) fperfdata Formatter f = new Formatter(new StringBuffer()); if (label.matches("['= ]")) f.format("'%s'=", label); else f.format("%s=", label); f.format("%f", val); f.format("%s;", uom); if (warnp != 0) ... |
String | generateMacOnIncrease(final String baseMac, final long l) generate Mac On Increase long mac = mac2Long(baseMac); if (l > 0xFFFFl) { return null; mac = mac + (l << 24); mac = mac & 0x06FFFFFFFFFFl; return long2Mac(mac); |