Package org.ofbiz.core.util
Class UtilFormatOut
java.lang.Object
org.ofbiz.core.util.UtilFormatOut
General output formatting functions - mainly for helping in JSPs
- Since:
- 2.0
- Version:
- $Revision: 1.1 $
- Author:
- David E. Jones, Andy Zeneski
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcheckEmpty(String string1, String string2) Returns the first passed String if not empty, otherwise the second if not empty, otherwise an empty but non-null String.static StringcheckEmpty(String string1, String string2, String string3) Returns the first passed String if not empty, otherwise the second if not empty, otherwise the third if not empty, otherwise an empty but non-null String.static StringChecks to see if the passed string is null, if it is returns an empty but non-null string.static StringReturns the first passed String if not null, otherwise the second if not null, otherwise an empty but non-null String.static StringReturns the first passed String if not null, otherwise the second if not null, otherwise the third if not null, otherwise an empty but non-null String.static StringReturns the first passed String if not null, otherwise the second if not null, otherwise the third if not null, otherwise the fourth if not null, otherwise an empty but non-null String.static StringdecodeQueryValue(String query) Decodes a single query value from an HTTP URL parameter, replacing %ASCII values with charactersstatic StringencodeQuery(String query) Encodes an HTTP URL query String, replacing characters used for other things in HTTP URL query strings, but not touching the separator characters '?', '=', and '&'static StringencodeQueryValue(String query) Encodes a single HTTP URL query value, replacing characters used for other things in HTTP URL query stringsstatic StringencodeXmlValue(String inString) Encodes an XML string replacing the characters '<', '>', '"', ''', '&'static StringformatDate(Timestamp timestamp) Formats a String timestamp into a nice stringstatic StringformatPercentage(double percentage) Formats a double representing a percentage into a stringstatic StringformatPercentage(Double percentage) Formats a Double representing a percentage into a stringstatic StringformatPrice(double price) Formats a double representing a price into a stringstatic StringformatPrice(Double price) Formats a Double representing a price into a stringstatic StringformatQuantity(double quantity) Formats an double representing a quantity into a stringstatic StringformatQuantity(float quantity) Formats a float representing a quantity into a stringstatic StringformatQuantity(int quantity) Formats an int representing a quantity into a stringstatic StringformatQuantity(long quantity) Formats an int representing a quantity into a stringstatic StringformatQuantity(Double quantity) Formats an Double representing a quantity into a stringstatic StringformatQuantity(Float quantity) Formats a Float representing a quantity into a stringstatic StringformatQuantity(Integer quantity) Formats an Integer representing a quantity into a stringstatic StringformatQuantity(Long quantity) Formats an Long representing a quantity into a stringstatic StringifNotEmpty(String base, String pre, String post) Returnspre + base + postif base String is not null or empty, otherwise an empty but non-null String.static StringmakeString(Object obj1) Checks to see if the passed Object is null, if it is returns an empty but non-null string, otherwise calls toString() on the objectstatic StringreplaceString(String mainString, String oldString, String newString) Replaces all occurances of oldString in mainString with newString
-
Constructor Details
-
UtilFormatOut
public UtilFormatOut()
-
-
Method Details
-
formatPrice
Formats a Double representing a price into a string- Parameters:
price- The price Double to be formatted- Returns:
- A String with the formatted price
-
formatPrice
Formats a double representing a price into a string- Parameters:
price- The price double to be formatted- Returns:
- A String with the formatted price
-
formatPercentage
Formats a Double representing a percentage into a string- Parameters:
percentage- The percentage Double to be formatted- Returns:
- A String with the formatted percentage
-
formatPercentage
Formats a double representing a percentage into a string- Parameters:
percentage- The percentage double to be formatted- Returns:
- A String with the formatted percentage
-
formatQuantity
Formats an Long representing a quantity into a string- Parameters:
quantity- The quantity Long to be formatted- Returns:
- A String with the formatted quantity
-
formatQuantity
Formats an int representing a quantity into a string- Parameters:
quantity- The quantity long to be formatted- Returns:
- A String with the formatted quantity
-
formatQuantity
Formats an Integer representing a quantity into a string- Parameters:
quantity- The quantity Integer to be formatted- Returns:
- A String with the formatted quantity
-
formatQuantity
Formats an int representing a quantity into a string- Parameters:
quantity- The quantity int to be formatted- Returns:
- A String with the formatted quantity
-
formatQuantity
Formats a Float representing a quantity into a string- Parameters:
quantity- The quantity Float to be formatted- Returns:
- A String with the formatted quantity
-
formatQuantity
Formats a float representing a quantity into a string- Parameters:
quantity- The quantity float to be formatted- Returns:
- A String with the formatted quantity
-
formatQuantity
Formats an Double representing a quantity into a string- Parameters:
quantity- The quantity Double to be formatted- Returns:
- A String with the formatted quantity
-
formatQuantity
Formats an double representing a quantity into a string- Parameters:
quantity- The quantity double to be formatted- Returns:
- A String with the formatted quantity
-
formatDate
Formats a String timestamp into a nice string- Parameters:
timestamp- String timestamp to be formatted- Returns:
- A String with the formatted date/time
-
makeString
Checks to see if the passed Object is null, if it is returns an empty but non-null string, otherwise calls toString() on the object- Parameters:
obj1- The passed Object- Returns:
- The toString() of the passed Object if not null, otherwise an empty non-null String
-
checkNull
Checks to see if the passed string is null, if it is returns an empty but non-null string.- Parameters:
string1- The passed String- Returns:
- The passed String if not null, otherwise an empty non-null String
-
checkNull
Returns the first passed String if not null, otherwise the second if not null, otherwise an empty but non-null String.- Parameters:
string1- The first passed Stringstring2- The second passed String- Returns:
- The first passed String if not null, otherwise the second if not null, otherwise an empty but non-null String
-
checkNull
Returns the first passed String if not null, otherwise the second if not null, otherwise the third if not null, otherwise an empty but non-null String.- Parameters:
string1- The first passed Stringstring2- The second passed Stringstring3- The third passed String- Returns:
- The first passed String if not null, otherwise the second if not null, otherwise the third if not null, otherwise an empty but non-null String
-
checkNull
Returns the first passed String if not null, otherwise the second if not null, otherwise the third if not null, otherwise the fourth if not null, otherwise an empty but non-null String.- Parameters:
string1- The first passed Stringstring2- The second passed Stringstring3- The third passed Stringstring4- The fourth passed String- Returns:
- The first passed String if not null, otherwise the second if not null, otherwise the third if not null, otherwise the fourth if not null, otherwise an empty but non-null String
-
ifNotEmpty
Returnspre + base + postif base String is not null or empty, otherwise an empty but non-null String.- Parameters:
base- The base Stringpre- The pre Stringpost- The post String- Returns:
pre + base + postif base String is not null or empty, otherwise an empty but non-null String.
-
checkEmpty
Returns the first passed String if not empty, otherwise the second if not empty, otherwise an empty but non-null String.- Parameters:
string1- The first passed Stringstring2- The second passed String- Returns:
- The first passed String if not empty, otherwise the second if not empty, otherwise an empty but non-null String
-
checkEmpty
Returns the first passed String if not empty, otherwise the second if not empty, otherwise the third if not empty, otherwise an empty but non-null String.- Parameters:
string1- The first passed Stringstring2- The second passed Stringstring3- The third passed String- Returns:
- The first passed String if not empty, otherwise the second if not empty, otherwise the third if not empty, otherwise an empty but non-null String
-
encodeQuery
Encodes an HTTP URL query String, replacing characters used for other things in HTTP URL query strings, but not touching the separator characters '?', '=', and '&'- Parameters:
query- The plain query String- Returns:
- The encoded String
-
encodeQueryValue
Encodes a single HTTP URL query value, replacing characters used for other things in HTTP URL query strings- Parameters:
query- The plain query value String- Returns:
- The encoded String
-
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
-
decodeQueryValue
Decodes a single query value from an HTTP URL parameter, replacing %ASCII values with characters- Parameters:
query- The encoded query value String- Returns:
- The plain, decoded String
-
encodeXmlValue
Encodes an XML string replacing the characters '<', '>', '"', ''', '&'- Parameters:
inString- The plain value String- Returns:
- The encoded String
-