List of utility methods to do Number to String
String | numberToString(double num, int digits) number To String if (digits < 0) throw new RuntimeException("Digits must be >= 0!"); String[] parts = String.valueOf(num).split("[.]"); if (parts[1].matches("0")) return parts[0]; if (parts[1].length() > digits) { String end = parts[1].substring(0, digits); while (end.endsWith("0")) ... |
String | numberToString(int gmNumber) Translates the General-Midi-Instrument-Number into a human readable string. if ((gmNumber >= 0) && (gmNumber < instrumentNames.length)) { return instrumentNames[gmNumber]; return "" + gmNumber; |
String | numberToString(int number, int length, String type, int location) number To String String numberStr = String.valueOf(number); if (numberStr.length() == length) { return numberStr; } else if (numberStr.length() > length) { return numberStr.substring(numberStr.length() - length); StringBuffer value = new StringBuffer(); for (int i = 0; i < length - numberStr.length(); i++) { ... |
String | numberToString(Number number) Produce a string from a Number. if (number == null) { return "null"; if (!testValidity(number)) { throw new RuntimeException("Can't convert number: " + number); String string = number.toString(); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 && string.indexOf('E') < 0) { ... |
String | numberToString(Object instance) number To String String s = instance.toString(); int i = s.lastIndexOf("."); if (i == -1) { return s; String result = s.substring(0, i); return result; |
String | numberToString(Object num) number To String if (num == null) { return null; } else if (num instanceof Integer && (Integer) num > 0) { return Integer.toString((Integer) num); } else if (num instanceof Long && (Long) num > 0) { return Long.toString((Long) num); } else if (num instanceof Float && (Float) num > 0) { return Float.toString((Float) num); ... |
String | numberToStringFlushLeft(long number, int width) Returns a return flushLeft(Long.toString(number), width);
|