public class StringLib
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
abbreviate(java.lang.String str,
java.awt.FontMetrics fm,
int width)
Abbreviate a String by simply truncating it.
|
static java.lang.String |
abbreviateName(java.lang.String str,
java.awt.FontMetrics fm,
int width)
Abbreviate a String as a given name.
|
static java.lang.String |
capitalizeFirstOnly(java.lang.String s)
Capitalize all letters preceded by whitespace, and lower case
all other letters.
|
static java.lang.String |
formatNumber(double number,
int decimalPlaces)
Format the given number as a String, including the given number of
decimal places.
|
static java.lang.String |
getArrayString(java.lang.Object a)
Given an array object, create a String showing the contents
of the array using a "[a[0], a[1], ..., a[a.length-1]]" format.
|
static java.lang.String |
getStackTrace(java.lang.Throwable t)
Get the stack trace of the given Throwable as a String.
|
public static final java.lang.String getArrayString(java.lang.Object a)
a - the array objectpublic static java.lang.String formatNumber(double number,
int decimalPlaces)
number - the number to formatdecimalPlaces - the number of decimal places to includepublic static java.lang.String capitalizeFirstOnly(java.lang.String s)
s - the String to capitalizepublic static java.lang.String getStackTrace(java.lang.Throwable t)
t - the Throwablepublic static java.lang.String abbreviate(java.lang.String str,
java.awt.FontMetrics fm,
int width)
str - the String to abbreviatefm - the FontMetrics for measuring the String lengthwidth - the maximum string width, in pixelspublic static java.lang.String abbreviateName(java.lang.String str,
java.awt.FontMetrics fm,
int width)
str - the String to abbreviatefm - the FontMetrics for measuring the String lengthwidth - the maximum string width, in pixels