UDF - Right justification
I need to create UDF for the right justification of the characters. I've one sample UDF that does the same job but in that UDF the lenght of the string is fixed (20 char). In my requiremens the lenght of the input string is varying.
Please can anyone suggest me how to do this? what are the changes requires in the sample UDF?
Or if anyone has that UDF available please post it or send me.
Here is the sample UDF :
String padChar = " ";
int maxLen = 20;
int padLen = str.length();
int sLen = (maxLen - padLen);
if (padLen >= maxLen)
StringBuffer sb = new StringBuffer(sLen);
for (int count = sLen; count > 0; count--)
str = sb.toString() + str;