on 07-17-2014 7:43 PM
Hi
I am using following udf for splitting the text in to each 70 charcters to target each tdline which is working
But i need add the below logic in to it. can someone help
split the source text in to each 70 characters on each target tdline
But if the text contains *
copy string upto * in first tdline
second tdline with the remaing text after * continuous in loop for the
remaining text
else
copy with 70 charcters splitting for each tdline
Thanks for your help
Hi Mahesh
I checked your UDF, looked very complex to me.
I wrote the below logic, please try it out.
Also i have added the new logic which you mentioned about *
As per my understanding if you have a string with 150 chars with * at 100th character
then it should be split like first 100 chars in first tdline and then remaining in 2nd.
If my understanding is wrong please correct me.
if(!var1[0].equals("") && !var1[0].contains("*"))
{
while (var1[0].length()>=70) {
result.addValue(var1[0].substring(0,70));
var1[0] = var1[0].substring(70);
}
result.addValue(var1[0]);
}else{
result.addValue(var1[0].substring(0,var1[0].indexOf("*")));
result.addValue(var1[0].substring(var1[0].indexOf("*")+1));
}
Regards
Osman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Osman. If the string more than one * it is not working as expected. for example. input value = 1rwwewrwrre*2rwwwewrwwr*3werwrr.getting in first tdline 1rwwewrwrre and 2nd tdline =2rwwwewrwwr*3werwrr but expected 2rwwwewrwwr and third tdline value = 3werwrr
It there is no * it is working fine .
Thanks
I thought there will be only one * so i wrote such code.
Please use this
if(!var1[0].equals("") && !var1[0].contains("*"))
{
while (var1[0].length()>=70) {
result.addValue(var1[0].substring(0,70));
var1[0] = var1[0].substring(70);
}
result.addValue(var1[0]);
}else{
String[] s = var1[0].split("\\*");
for(int i=0; i<s.length;i++)
result.addValue(s[i]);
}
I just replaced the statements inside else condition.
Regards
Osman
User | Count |
---|---|
79 | |
9 | |
9 | |
7 | |
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.