|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.core.node.util.StringFormat
public final class StringFormat
Collection of convenience methods to format strings (such as elapsed time or urls).
Method Summary | |
---|---|
static String |
formatElapsedTime(long timeInMS)
Formats a time difference into a string stating elapsed days, hours etc. |
static String |
formatPath(String str,
int size)
Formats paths such as file locations or URLs. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static String formatPath(String str, int size)
The pattern is as follows: If size
is smaller than 30,
return the last size
chars in the string (plus some dots
in front); if the size
is larger than 30: return the first
12 chars + ... + chars from the end. If it is larger than 55: the first
28 + ... + rest from the end.
str
- The string to format. If null
an empty string
is returned.size
- The requested size. Negative or too small (< 3) values are
treated with respect, i.e. no exception is thrown.
public static String formatElapsedTime(long timeInMS)
formatElapsedTime(3000L)
will only return
"3 secs").
timeInMS
- The time in milliseconds, negative values will
be preceded by a minus sign
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |