List of utility methods to do Formatter Usage
String | displayStackTrace() display Stack Trace return displayStackTrace(null);
|
void | echo(Formatter script, String label, String message, String file) echo script.format("echo \"#AT_%s %s\" >> %s\n", label, message, file);
|
String | encodeHex(byte[] bytes) Converts the given byte array to a Hex formatted string. Formatter hexStringFormatter = new Formatter(); for (byte b : bytes) { hexStringFormatter.format("%02X", b); return hexStringFormatter.toString(); |
String | escapeUnicode(String input) escape Unicode StringBuilder b = new StringBuilder(input.length()); Formatter f = new Formatter(b); for (char c : input.toCharArray()) { if (c < 128) { b.append(c); } else { f.format("%02X", (int) c); f.close(); return b.toString(); |
String | floatForSql(Float f) generate a nice string representation of this floating point number suitable for Sql if (f == null) return "NULL"; Formatter fmt = new Formatter(); fmt.format("%.2f", f); return fmt.toString(); |
String | Fmt(String format, Object... args) Fmt return new Formatter().format(format, args).toString(); |
String | format(double value) Format the given value into a representation with 4 digits after the comma.
return format(value, 4);
|
String | format(Locale l, String format, Object... args) Returns a formatted string using the specified locale, format string, and arguments. return new Formatter(l).format(format, args).toString(); |
String | format(String format, Object... args) format return format(null, format, args);
|
String | format_hh_mm_ss_Optional(final long value) formahms Optional boolean isShowSeconds = true; final int seconds = (int) ((value % 3600) % 60); if (isShowSeconds && seconds == 0) { isShowSeconds = false; String valueText; if (isShowSeconds) { valueText = format_hh_mm_ss(value); ... |