on 09-11-2008 12:05 PM
Hi,
Source is sending some fields with leading zeros , zeros need to be removed in target system.
In mapping any functions are there ana wat are the functions
Regards,
SB
Hi,
Write a UDF to remove the zeros
public String RemoveLeadingZeroes(String a,Container container){
String str =a;
String res = "";
String temp = "";
String res1 = "";
char ch[] = null;
int count = 0;
if(str != null)
ch = str.toCharArray();
for(int k=0; k<ch.length;k++)
{
if(ch[k] == '0')
count ++;
}
temp = a.substring(count,count+3);
return temp;
}
Above UDF will help u in solving u r issue
Regards,
Jayasimha Jangam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
No need of UDF. With the standard function you can do this.
Source & constant(1) -
> divide(Arithmetic function) -
> Target
any number with leedin zero's divided or even multiplied by 1 is that number without leeding zero's
Thanks
SaNv...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
u can try any of the one in UDF:
Integer.valueOf("000123").toString();
or
String result = Integer.toString(Integer.parseInt(a));
chirag
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Write this UDF of cache Value
String str1 = null;
str1 = a.replaceFirst("0*",""); // a is field passed to UDF as parameter
return str1;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
24 | |
11 | |
9 | |
7 | |
5 | |
5 | |
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.