|
PulpCore | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpulpcore.util.StringUtil
public final class StringUtil
Provides utilities for manipulating and formatting text strings.
| Method Summary | |
|---|---|
static boolean |
equals(String arg1,
String arg2)
Safe equality check for two strings. |
static String |
format(String message,
Object arg)
Calls StringUtil.format(message, new Object[] { arg }); |
static String |
format(String message,
Object[] args)
Formats a text string converting codes with string arguments. |
static String |
replace(String str,
String target,
String replacement)
Replace all instances of target in string str with the replacement string. |
static String[] |
split(String line,
char delimiter)
Splits a string into an array of strings seperated by the specified delimiter. |
static String[] |
wordWrap(String text,
CoreFont font,
int maxWidth)
Word-wraps a line of text to multiple lines. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static String format(String message,
Object arg)
StringUtil.format(message, new Object[] { arg });
public static String format(String message,
Object[] args)
| Conversion | Description |
| %s | Any object converted to a string. ("Hello World") |
| %d | An integer - Integer, Int, or Fixed (rounded). ("1000") |
| %,d | An integer with a grouping seperator. ("1,000") |
| %f | Fixed-point number. ("1000.12345") |
| %,f | Fixed-point number with a grouping seperator. ("1,000.12345") |
| %.2f | Fixed-point number with a specific number of digits after the decimal ("1000.12") |
| %,.2f | Fixed-point number with a grouping seperator and a specific number of digits ("1,000.12") |
| %% | The percent character. |
Example: format("Name: %s Score: %,d", new Object[] {"Fred", new Integer(1000)}); returns "Name: Fred Score: 1,000"
public static String replace(String str,
String target,
String replacement)
public static String[] wordWrap(String text,
CoreFont font,
int maxWidth)
public static String[] split(String line,
char delimiter)
public static boolean equals(String arg1,
String arg2)
|
PulpCore | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||