on 10-22-2014 3:14 PM
Hi,
We have a requirement to get the first and last values from one element for target 2 elements.
I wrote a udf for get the first value as below
public void getItem1(String[] a, ResultList output1, Container container) throws StreamTransformationException{
for(int i=0;i<a.length;i++)
{
if(a[i].length()>0)
{
String str1[]= a[i].split("\\,");
output1.addValue(str1[0]);
}
else
{
output1.addValue("");
}
}
and it is working fine.Now i want to get the last value as output,
Example:
In a element we getting some values with separate comma like 455657656,22323,76576,71236,98098,.......,67676.
I want to get the last value after the comma 67676 as a output.
Can you please help me on this.
Thanks in advance.
Hi Guys,
I solved the issue by own.Here is the UDF to get the last value.
String str = var1.toString();
String a[]= str.split(",");
int len = a.length;
return a[len-1];
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.