|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgate.util.Strings
public class Strings
Some utilities for use with Strings.
| Field Summary | |
|---|---|
private static boolean |
DEBUG
Debug flag |
private static String |
fileSep
Local fashion for file separators. |
private static String |
newline
Local fashion for newlines this year. |
private static char |
padChar
What character to pad with. |
private static String |
pathSep
Local fashion for path separators. |
| Constructor Summary | |
|---|---|
Strings()
|
|
| Method Summary | |
|---|---|
static String |
addLineNumbers(String text)
Helper method to add line numbers to a string |
static String |
addLineNumbers(String text,
int startLine)
|
static String |
addPadding(String pad,
int n)
Add n pad characters to pad. |
static String |
crop(String text,
int maxLength)
Crop the text in the middle if too long. |
static String |
getFileSep()
Get local fashion for file separators (e.g. "/"). |
static String |
getNl()
Get local fashion for newlines. |
static String |
getPathSep()
Get local fashion for path separators (e.g. ":"). |
static List<String> |
toList(String string,
String separator)
Get back a List of String from its String representation. |
static Map<String,String> |
toMap(String string)
Get back a Map of String*String from its String representation. |
static String |
toString(List<String> list)
Create a String representation of a List of String with the format [value, value]. |
static String |
toString(Map<String,String> map)
Create a String representation of a Map of String*String with the format {key=value, key=value}. |
static String |
toString(Object object)
Convert about any object to a human readable string. |
static String |
unescape(String str)
A method to unescape Java strings, returning a string containing escape sequences into the respective character. i.e. "\" followed by "t" is turned into the tab character. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final boolean DEBUG
private static char padChar
private static String newline
private static String pathSep
private static String fileSep
| Constructor Detail |
|---|
public Strings()
| Method Detail |
|---|
public static String getNl()
public static String getPathSep()
public static String getFileSep()
public static String addPadding(String pad,
int n)
public static String addLineNumbers(String text)
public static String addLineNumbers(String text,
int startLine)
public static String unescape(String str)
str - the string to unescape
public static String toString(Object object)
Arrays.deepToString(Object[]) to convert an array or
a collection.
object - object to be converted to a string
public static String toString(List<String> list)
list - list to convert to one String
toList(String, String)public static String toString(Map<String,String> map)
map - map to convert to one String
toMap(String)
public static List<String> toList(String string,
String separator)
string - String to convert to a Listseparator - String that delimits the element of the list
toString(java.util.List)public static Map<String,String> toMap(String string)
string - String to convert to a Map
toString(java.util.Map)
public static String crop(String text,
int maxLength)
text - text to cropmaxLength - maximum length of the text
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||