public static Object pad(String str, Integer padLength, String padStr, boolean left)
throws FunctionExecutionException {
int length = padLength.intValue();
if(length < 1) {
throw new FunctionExecutionException("ERR.015.001.0025", QueryPlugin.Util.getString("ERR.015.001.0025")); //$NON-NLS-1$ //$NON-NLS-2$
}
if(length < str.length()) {
return new String(str.substring(0, length));
}
if(length > DataTypeManager.MAX_STRING_LENGTH) {
length = DataTypeManager.MAX_STRING_LENGTH;
}
// Get pad character
if(padStr.length() == 0) {
throw new FunctionExecutionException("ERR.015.001.0027", QueryPlugin.Util.getString("ERR.015.001.0027")); //$NON-NLS-1$ //$NON-NLS-2$
}
// Pad string
StringBuffer outStr = new StringBuffer(str);
while(outStr.length() < length) {
if (left) {