public class NotimaUtil extends Object
| Constructor and Description |
|---|
NotimaUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Date |
addDays(Date date,
int daysToAdd)
Adds number of days on specified date
|
static int |
daysFromNow(Date date)
Returns number of days from today
|
static String |
fillToLength(String str,
boolean rightAlign,
char fillChar,
int len)
Fills to a specified length
|
static String |
getAmountStr(double amount)
Converts a double to 12 digits where the two last digits
are "öre" or "cents".
|
static String |
getAmountStr(double amount,
int len,
boolean absolute) |
static int |
getLuhnDigit(double amount)
Return Luhn Digit using an amount as in data
|
static int |
getLuhnDigit(String indata)
Luhn algoritm.
|
static boolean |
hasDigitsOnly(String ref) |
static boolean |
isValidOCRNumber(String OCR)
Validate OCR number
|
static String |
onlyUSASCII(String clearupstring)
Removes all non USASCII chars and converts to uppercase.
|
static double |
parseAmountStr(String amountStr) |
static String |
removeBlanks(String cleanUp)
Remove blanks from a string.
|
static String |
toDigitsOnly(String cleanUp)
Remove all non digit characters
|
static String |
toOCRNumber(String indata)
Converts a string of digits to the equivalent OCR-number
|
static String |
toOCRNumberWithLengthCheck(String indata)
Converts a string of digits to an OCR-number with length check
|
static String |
trimLeadingZeros(String cleanUp) |
static boolean |
validateBankgiro(String Bankgiro)
Validate Bankgiro
|
static boolean |
validateIban(String swift,
String iban)
Perform very basic validation (length checks)
|
public static String toDigitsOnly(String cleanUp)
cleanUp - String to be cleaned.public static boolean hasDigitsOnly(String ref)
public static String removeBlanks(String cleanUp)
cleanUp - String to clean up.public static boolean validateIban(String swift, String iban)
swift - Swift to be validated.iban - Iban to be validated.public static boolean validateBankgiro(String Bankgiro)
Bankgiro - A string containing the bankgiro to be validated.public static String getAmountStr(double amount)
amount - The amount to be formatted.public static String getAmountStr(double amount, int len, boolean absolute)
amount - The amount to be converted.len - Let you specify the length of the stringabsolute - If true no negative indicator. If false the last digit is replaced
with a letter according to a specific pattern to indicate a negative
value.public static double parseAmountStr(String amountStr)
public static int getLuhnDigit(double amount)
amount - The amountpublic static int getLuhnDigit(String indata)
indata - The numbers to calculated a Luhn digit from.public static String toOCRNumber(String indata)
indata - The data to be convertedpublic static String toOCRNumberWithLengthCheck(String indata)
indata - Numbers to be converted.public static boolean isValidOCRNumber(String OCR)
OCR - The OCR-number to validatepublic static String fillToLength(String str, boolean rightAlign, char fillChar, int len)
str - The string to be filled. If null it will be filled only with fillChar.rightAlign - If the string should be right aligned.fillChar - The char to fill.len - Lenght to fill. If str is more than len, str is truncated.public static String onlyUSASCII(String clearupstring)
clearupstring - The string to be cleared.public static int daysFromNow(Date date)
date - Date to checkCopyright © 2021 Notima System Integration AB. All rights reserved.