on 08-21-2008 9:46 PM
Hi Experts,
I am getting error in my code.Could you please correct me where it is?
public void ElemDetail(String[] Input,ResultList result,Container container){
//write your code here
int Tlength = Input.length();
int position = 0;
int nposition = 0;
int recleng = 0;
int spa = 0;
for(int i=1; i<Tlength; i++)
if (Input.charAt(i) == '+')
{
position = i;
spa = i + 5;
if (Input.charAt(spa) ==' ')
{
for (int j = position1; j<Tlength; j+)
if (Input.charAt(j) =='+' )
{
nposition = j;
recleng = j - 1;
j = Tlength + 1;
result.addValue(Input.substring(position, nposition));
}
}
}
}
Hi,
There are many errors in code.
for instance: There is no method called Input.charAt() in string array, you can use this method in String and not for String array. it should be Input<i>.charAt() method
you cannot use length() method for string array, you just need to give Input.length .
Go through your code again.
amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The main error of the above code was with Input field. Its Array of String, so the operations that you have added are on string ...thus the Input[k] is required to specify the particular string.
if you will be sending only one value as source side then you should have use the Cache parameter = Value then your previous code will work fine. But for multiple values below is the corrected code.
//write your code here
int position = 0;
int nposition = 0;
int recleng = 0;
int spa = 0;
int Tlength = 0;
for(int k = 0; Input.length>k; k++)
{
Tlength = Input[k].length();
for(int i=1; i<Tlength; i++)
{
if (Input[k].charAt(i) == '+')
{
position = i;
spa = i + 5;
if (Input[k].charAt(spa) ==' ')
{
for (int j = position+1; j<Tlength; j++)
if (Input[k].charAt(j) =='+' )
{
nposition = j;
recleng = j - 1;
j = Tlength + 1;
result.addValue(Input[k].substring(position, nposition));
}
}
}
}
}
Thanks
swarup
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.