Package com.prineside.tdi2.utils
Class StringFormatter
java.lang.Object
com.prineside.tdi2.utils.StringFormatter
- 
Nested Class Summary
Nested Classes - 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic StringbytesToHex(byte[] bytes) static floatcalculateWidth(CharSequence text, BitmapFont font) static StringBuildercommaSeparatedNumber(long number) static ByteArraycompactBytes(byte[] bytes, int offset, int count) static StringBuildercompactNumber(double number, boolean withPoint) static StringBuildercompactNumberWithPrecision(double number, int pointPrecision) Форматирует число так, чтобы всегда было 3 цифры 1913 => 1.91K 28415 => 28.4K 913275 => 913K ...static StringBuildercompactNumberWithPrecisionTrimZeros(double number, int pointPrecision, boolean trimLeadingZeros) static StringBuilderdigestTime(int seconds) static StringBuilderdigestTimeWithZeroHours(int seconds, boolean prependZeroHours) static StringdistinguishableString(int i) static CharSequencefitToWidth(CharSequence text, float width, BitmapFont font, CharSequence truncate) static byte[]fromBase64(String string) static byte[]fromCompactBase64(String string) static ByteArrayOutputStreamfromCompactBytes(byte[] buffer, int offset, int size) static StringBuilderintToString(int v) static Stringstatic byte[]md5HashToBytes(String data) static StringromanNumber(int number) static StringRemoves lower-case vowels from the first word it spots (English alphabet)static StringstringFromCompactBase64(String string) static Stringstatic CharSequencestripTerminalColors(String message) Removes tags which start with and end with m Works only for 8 and 16 colors of font / background, styles and style resets Does not work with 256 colors, cursor movements and screen commands (why would you need them in logs in the first place?)static StringtimePassed(int seconds, boolean appendZeroValues, boolean appendDays) Форматирует время.static StringtoBase64(byte[] bytes, int offset, int count) static StringtoCompactBase64(byte[] bytes, int offset, int count) static StringBuildertoLowerCase(CharSequence chars) static StringBuilderstatic StringBuildertoUpperCase(CharSequence chars)  
- 
Field Details
- 
DISTINGUISHABLE_STRING_CHARS
- See Also:
 
 - 
DIST_STRING_CHAR_TO_IDX
 - 
VALID_EMAIL_ADDRESS_REGEX
 
 - 
 - 
Constructor Details
- 
StringFormatter
public StringFormatter() 
 - 
 - 
Method Details
- 
bytesToHex
 - 
toUpperCase
 - 
toLowerCase
 - 
toRGB
- Returns:
 - RRGGBB
 
 - 
digestTime
 - 
digestTimeWithZeroHours
 - 
timePassed
Форматирует время. 62 -> 1 м 2 с- Parameters:
 seconds- время в секундах- Returns:
 - строка вида "8 ч 13 м 7 с"
 
 - 
commaSeparatedNumber
 - 
compactNumberWithPrecision
Форматирует число так, чтобы всегда было 3 цифры 1913 => 1.91K 28415 => 28.4K 913275 => 913K ... pointPrecision работает только на числа до 100 K 3 M 6 B 9 T 12 - 
compactNumberWithPrecisionTrimZeros
public static StringBuilder compactNumberWithPrecisionTrimZeros(double number, int pointPrecision, boolean trimLeadingZeros)  - 
compactNumber
 - 
romanNumber
- Parameters:
 number- от 1 до 39- Returns:
 - римские цифры
 
 - 
distinguishableString
 - 
toCompactBase64
 - 
toBase64
 - 
compactBytes
 - 
fromCompactBytes
 - 
fromCompactBase64
 - 
fromBase64
 - 
stringToCompactBase64
 - 
stringFromCompactBase64
 - 
md5Hash
 - 
md5HashToBytes
 - 
calculateWidth
 - 
fitToWidth
public static CharSequence fitToWidth(CharSequence text, float width, BitmapFont font, CharSequence truncate)  - 
intToString
 - 
shortenFirstWord
Removes lower-case vowels from the first word it spots (English alphabet) - 
stripTerminalColors
Removes tags which start with and end with m Works only for 8 and 16 colors of font / background, styles and style resets Does not work with 256 colors, cursor movements and screen commands (why would you need them in logs in the first place?) 
 -