Package com.sun.enterprise.util
Class StringUtils
java.lang.Object
com.sun.enterprise.util.StringUtils
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringConcatenate a list of strings, putting a separator in between each one.static StringescapeForHtml(String str) Escape characters to use result in html.static Stringstatic Stringstatic StringgetProperty(String propName) Get a system propety given a property name, possibly trying all combination of upercase, name mangling to get a value.static Stringstatic booleanisHex(char c) static booleanstatic final booleanstatic voidstatic StringmakeFilePath(String[] strings, boolean addTrailing) A utility to get the Operating System specific path from given array of Strings.static intstatic StringIf givenStringisnullthen returns emptyStringotherwise returns givenStringstatic booleanstatic Stringstatic StringparseStringList(String line) Parses a string containing substrings separated from each other by the standard separator characters and returns a list of strings.parseStringList(String line, String sep) Parses a string containing substrings separated from each other by the specified set of separator characters and returns a list of strings.static voidstatic StringquotePathIfNecessary(String path) Nightmares can result from using a path with a space in it!static StringquotePathIfNecessary(String path, char quoteChar) Nightmares can result from using a path with a space in it!static StringremoveChar(String strOrig, char c) Remove a character from a Stringstatic StringRemoves the quoting around a String.static Stringstatic intsafeLength(String s) return the length of the String - or 0 if it's nullstatic final StringstripToken(String s) static voidstatic String[]static StringtoShortClassName(String className) static StringtoString(Properties props) static String
-
Field Details
-
NEWLINE
-
EOL
-
-
Method Details
-
safeLength
return the length of the String - or 0 if it's null -
ok
-
formatSQLException
-
maxWidth
-
isHex
-
isHex
public static boolean isHex(char c) -
getPenultimateDirName
-
toShortClassName
-
padRight
-
padLeft
-
toLines
-
prepend
-
upperCaseFirstLetter
-
replace
-
toString
-
main
-
testUpperCase
public static void testUpperCase() -
makeFilePath
A utility to get the Operating System specific path from given array of Strings.- Parameters:
strings- an array of Strings participating in the path.addTrailing- a boolean that determines whether the returned String should have a trailing File Separator character. None of the strings may be null or empty String. An exception is thrown.- Returns:
- a String that concatenates these Strings and gets a path. Returns a null if the array is null or contains no elements.
- Throws:
IllegalArgumentException- if any of the arguments is null or is an empty string.
-
parseStringList
Parses a string containing substrings separated from each other by the standard separator characters and returns a list of strings. Splits the stringlineinto individual string elements separated by the field separators, and returns these individual strings as a list of strings. The individual string elements are trimmed of leading and trailing whitespace. Only non-empty strings are returned in the list.- Parameters:
line- The string to split- Returns:
- Returns the list containing the individual strings that the input string was split into.
-
parseStringList
Parses a string containing substrings separated from each other by the specified set of separator characters and returns a list of strings. Splits the stringlineinto individual string elements separated by the field separators specified insep, and returns these individual strings as a list of strings. The individual string elements are trimmed of leading and trailing whitespace. Only non-empty strings are returned in the list.- Parameters:
line- The string to splitsep- The list of separators to use for determining where the string should be split. If null, then the standard separators (see StringTokenizer javadocs) are used.- Returns:
- Returns the list containing the individual strings that the input string was split into.
-
getProperty
Get a system propety given a property name, possibly trying all combination of upercase, name mangling to get a value.- Parameters:
propName- the approximate system property name- Returns:
- the property value if found, null otherwise
-
removeChar
Remove a character from a String- Parameters:
strOrig- original stringc- character to remove from the string- Returns:
- String with specified characters removed
-
getStackTrace
-
isToken
-
stripToken
-
cat
Concatenate a list of strings, putting a separator in between each one. If the list is one string, then the separator is not used. The separator will never be added to the start or end of the returned string. When empty or null strings are encountered in the list of strings they are ignore.- Parameters:
separator- Separator to use between concatenated stringslist- List of strings to concatenate together- Returns:
- String created by concatenating provided strings
-
removeEnclosingQuotes
Removes the quoting around a String.- Parameters:
s- The String that may have enclosing quotes- Returns:
- The String resulting from removing the enclosing quotes
-
quotePathIfNecessary
Nightmares can result from using a path with a space in it! This method will enclose in double-quotes if needed.- Parameters:
path-- Returns:
-
quotePathIfNecessary
Nightmares can result from using a path with a space in it! This method will enclose in the specified quote characters if needed.- Parameters:
path-- Returns:
-
escapeForHtml
Escape characters to use result in html.Chars Escape sequence < < > > & & " " \t -
nvl
If givenStringisnullthen returns emptyStringotherwise returns givenString
-