on 09-17-2009 8:09 AM
Hi XI Experts,
I have a requirement as if input is alphanumeric then post the sam data to Target ,if it is numeric only then add zeros for that number but total length is 10,
can one help me for this UDF
Thanks
Hi,
Try this udf. write it as a simple UDF
myString is the name of input parameter
if (myString.matches("[a-zA-z0-9]*")) {
myString = myString;
}
else {
if (myString.length() != 10) {
int difference = 10 - myString.length();
for (int i=0; i< difference;i++)
myString = myString.concat("0");
}
}
return myString;
Regards
suraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
also you can use like as follows
createUDF with one argument input
try{
Integer.parseInt(input);
} catch(NumberFormatException nfe) {
return false;
}
return true;
input--->formatNum[0000000000]\
then
input-->UDF------------------->if---------->Target Field
input------> else
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
creat a UDF with one argument input
try{
Integer.parseInt(input);
} catch(NumberFormatException nfe) {
return input ;
}
if(input.length()<10)
{
int difference = 10 - input.length();
for (int i=0; i< difference;i++) {
input ="0"+input ;
}
}
else if(input.length()>10)
return input.substring(0,10);
else
return input;
Edited by: Kubra fatima on Sep 17, 2009 9:54 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.