on 04-01-2010 11:22 AM
Can any one tell me how can i get an output with each character from input string separated with semicolon
e.g
Input : ABCD
Output : A;B;C;D (Semicolon separated)
Create an UDF having one input value:
and use:
String x = "ABCD"; -- input
String out = "";
int y = x.length();
for(int p = 0;p<y; p++){
if(p != y-1){
out = out + x.charAt(p) +";";
}
else{
out = out + x.charAt(p);
}
}
return out;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks to all
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, just check this
char[] inp_str;
String out = "";
inp_str = input.toCharArray();
for(int i=0; i<inp_str.length; i++)
{
out = out + inp_str<i>+";";
}
return out;
This is working, just add square brackets of i after inp_str.
Edited by: Ravi on Apr 1, 2010 10:39 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Use this code
Here var1 is the input parameter of array time, means it is queue type UDF
char[] stringArray;
stringArray = var1[0].toCharArray();
for(int i=0; i < stringArray.length; i++)
result.addValue(stringArray<i> + ";") ;
Note: result.addValue(stringArray [ i ] + ";") ; in this statement after stringArray and before and after i open_square_bracket and end_square_bracket are not visible here so make sure you use this braces in your code
Regards
Ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.