|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.pmd.util.StringUtil
public class StringUtil
Field Summary | |
---|---|
static String[] |
EMPTY_STRINGS
|
Constructor Summary | |
---|---|
StringUtil()
|
Method Summary | |
---|---|
static void |
appendXmlEscaped(StringBuffer buf,
String src)
Appends to a StringBuffer the String src where non-ASCII and XML special chars are escaped. |
static void |
asStringOn(StringBuffer sb,
Iterator iter,
String separator)
Copies the elements returned by the iterator onto the string buffer each delimited by the separator. |
static String |
htmlEncode(String string)
|
static boolean |
isSame(String s1,
String s2,
boolean trim,
boolean ignoreCase,
boolean standardizeWhitespace)
Are the two String values the same. |
static int |
lengthOfShortestIn(String[] strings)
Return the length of the shortest string in the array. |
static String |
lpad(String s,
int length)
Left pads a string. |
static int |
maxCommonLeadingWhitespaceForAll(String[] strings)
Determine the maximum number of common leading whitespace characters the strings share in the same sequence. |
static String |
replaceString(String original,
char oldChar,
String newString)
|
static String |
replaceString(String original,
String oldString,
String newString)
|
static String[] |
substringsOf(String source,
char delimiter)
Parses the input source using the delimiter specified. |
static String[] |
substringsOf(String str,
String separator)
Much more efficient than StringTokenizer. |
static String[] |
trimStartOn(String[] strings,
int trimDepth)
Trims off the leading characters off the strings up to the trimDepth specified. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String[] EMPTY_STRINGS
Constructor Detail |
---|
public StringUtil()
Method Detail |
---|
public static String replaceString(String original, char oldChar, String newString)
public static String replaceString(String original, String oldString, String newString)
public static void appendXmlEscaped(StringBuffer buf, String src)
buf
- The destination XML streamsrc
- The String to append to the streampublic static String htmlEncode(String string)
public static String[] substringsOf(String source, char delimiter)
source
- Stringdelimiter
- char
public static String[] substringsOf(String str, String separator)
str
- Stringseparator
- char
public static void asStringOn(StringBuffer sb, Iterator iter, String separator)
sb
- StringBufferiter
- Iteratorseparator
- Stringpublic static int lengthOfShortestIn(String[] strings)
strings
- String[]
public static int maxCommonLeadingWhitespaceForAll(String[] strings)
strings
- String[]
public static String[] trimStartOn(String[] strings, int trimDepth)
strings
- trimDepth
-
public static String lpad(String s, int length)
s
- The String to padlength
- The desired minimum length of the resulting padded String
public static boolean isSame(String s1, String s2, boolean trim, boolean ignoreCase, boolean standardizeWhitespace)
s1
- The first String.s2
- The second String.trim
- Indicates if the Strings should be trimmed before comparison.ignoreCase
- Indicates if the case of the Strings should ignored during comparison.standardizeWhitespace
- Indicates if the embedded whitespace should be standardized before comparison.
true
if the Strings are the same, false
otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |