Constructor | |
WUtil() Initializes a newly created WUtil object. |
|
Methods | |
String |
checkAmount(String amount) Formats the amount. [xxxxxx.xxx -> xxxxxx.xx] Parameters: amount - the amount to format Returns: a String that represents the formated amount Example: checkAmount("1234.561"); // returns 1234.56 |
String |
checkAmountNoCent(String amount) Formats the amount. [xxxxxx.xx -> xxxxxx] Parameters: amount - the amount to format Returns: a String that represents the formated amount Example: checkAmountNoCent("1234.56"); // returns 1234 |
String |
checkAmountComma(String amount) Formats the amount. [xxxxxx.xx -> xxx,xxx.xx] Parameters: amount - the amount to format Returns: a String that represents the formated amount Example: checkAmountComma("1234.56"); // returns 1,234.56 |
String |
checkAmountCommaNoCent(String amount) Formats the amount. [xxxxxx.xx -> xxx,xxx] Parameters: amount - the amount to format Returns: a String that represents the formated amount Example: checkAmountCommaNoCent("1234.56"); // returns 1,234 |
double |
getAmount(String amount) Converts the amount from String to double. Parameters: amount - the amount to convert Returns: a double that represents the amount Example: getAmount("1234.56"); // returns 1234.56 |
String |
setAmount(double amount) Converts the amount from double to String. Parameters: amount - the amount to convert Returns: a String that represents the amount Example: setAmount(1234.567); // returns 1234.57 |
String |
checkDouble(String value) Checks and adjusts the value for correct double representation. Parameters: value - the value to check Returns: a String that represents the value |
double |
getDouble(String value) Converts the value from String to double. Parameters: value - the value to convert Returns: a double that represents the value |
String |
setDouble(double value, int precision) Converts the value from double to String. Parameters: value - the value to convert precision - the precision [number of digits after decimal point] Returns: a String that represents the value |
String |
checkInt(String value) Checks and adjusts the value for correct int representation. Parameters: value - the value to check Returns: a String that represents the value |
int |
getInt(String value) Converts the value from String to int. Parameters: value - the value to convert Returns: an int that represents the value |
String |
setInt(int value) Converts the value from int to String. Parameters: value - the value to convert Returns: a String that represents the value |
WDateTime |
getDateTime(String dateTime) Creates WDateTime object and initializes it. Parameters: dateTime - the value to initialize with Returns: a WDateTime object |
WDateTime |
getLocalDateTime() Creates WDateTime object and initializes it with local date and time. Returns: a WDateTime object |
int |
checkDay(int day, int month) Checks and adjusts the day of the month. Parameters: day - the day [1,2,...31] month - the month [1,2,...12] Returns: a day number |
String |
getMonth(int month) Parameters: month - the month [1,2,...12] Returns: a String that represents the month name; an empty String if the month number is incorrect |
String |
checkStr(String str) Checks the string for single quotes and adds a second single quote next to original for each one found. This method is used for SQL INSERT and UPDATE. Parameters: str - the string to check Returns: a modified String Example: String str = "abc'123'xyz"; checkStr(str); // returns abc''123''xyz |
String |
checkStrHtml(String str) Checks the string for 0D0A, and replaces each one found with <br>. This method is used for showing a database text field on html page. Parameters: str - the string to check Returns: a modified String Example: String str = "abc 123"; checkStrHtml(str); // returns abc<br>123 |
Example | |
api_WUtil.java |