on 07-29-2011 11:59 AM
Hi All,
My scenario is Soap to RFC . A field by name ,Number , value may get a whole number or a decimal value.
The length of the field is 18.
If the value is a whole number then it should be with leading Zeros
EX:
A) Input :1234 Output :000000000000001234
If the value is a decimal number and then the output should be as such
B) Input:123.45 Output:123.45
Could any one help me out,to find whether the input value is decimal or whole number
Thanks in Advance
Lavanya.B
You can use standard function with some logic combination of the below function,
FormatNum, Indexof,If-else,Equals
input----indexof(.)--------equals(-1)--------if-else(false)---------formatnum(18 zeros) --------->Target
if-else(true)---------Target
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you can try this UDF
public static String checkEmptyField(String s) {
try
{
if(s!=null)
{
s=s.trim();
}
try
{
s=new Integer(s).toString();
int l=s.length();
for(int i=0;i<18-l;++i)
{
s="0"+s;
}
}
catch(NumberFormatException e)
{
s=new Double(s).toString();
}
}
catch(Exception e)
{
return s;
}
return s;
}
inputs ->1234,2.3,null
corrosponding outputs->000000000000001234,2.3,null
regards
Anupam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.