Package org.ofbiz.core.util
Class StringUtil
java.lang.Object
org.ofbiz.core.util.StringUtil
Misc String Utility Functions
- Since:
- 2.0
- Version:
- $Revision: 1.1 $
- Author:
- Andy Zeneski
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcleanUpPathPrefix(String prefix) Make sure the string starts with a forward slash but does not end with one; converts back-slashes to forward-slashes; if in String is null or empty, returns zero length string.static StringCreates a single string from a List of strings seperated by a delimiter.static StringCreates an encoded String from a Map of name/value pairs (MUST BE STRINGS!)quoteStrList(List<String> list) Encloses each of a List of Strings in quotes.static StringremoveSpaces(String str) Removes all spaces from a stringstatic StringreplaceString(String mainString, String oldString, String newString) Replaces all occurances of oldString in mainString with newStringSplits a String on a delimiter into a List of Strings.Creates a Map from an encoded name/value pair string
-
Constructor Details
-
StringUtil
public StringUtil()
-
-
Method Details
-
replaceString
Replaces all occurances of oldString in mainString with newString- Parameters:
mainString- The original stringoldString- The string to replacenewString- The string to insert in place of the old- Returns:
- mainString with all occurances of oldString replaced by newString
-
join
Creates a single string from a List of strings seperated by a delimiter.- Parameters:
list- a list of strings to joindelim- the delimiter character(s) to use. (null value will join with no delimiter)- Returns:
- a String of all values in the list seperated by the delimiter
-
split
Splits a String on a delimiter into a List of Strings.- Parameters:
str- the String to splitdelim- the delimiter character(s) to join on (null will split on whitespace)- Returns:
- a list of Strings
-
quoteStrList
Encloses each of a List of Strings in quotes.- Parameters:
list- List of String(s) to quote.
-
strToMap
Creates a Map from an encoded name/value pair string- Parameters:
str- The string to decode and format- Returns:
- a Map of name/value pairs
-
mapToStr
Creates an encoded String from a Map of name/value pairs (MUST BE STRINGS!)- Parameters:
map- The Map of name/value pairs- Returns:
- String The encoded String
-
cleanUpPathPrefix
Make sure the string starts with a forward slash but does not end with one; converts back-slashes to forward-slashes; if in String is null or empty, returns zero length string. -
removeSpaces
Removes all spaces from a string
-