on 10-30-2008 8:07 PM
Hello sdn
I have a udf but it gives an error : int cannot be dererenced.
can anyone suggest.
below is the udf
int pos = a.indexOf("RT");
if(pos.equals("-1"))
return("does not exists");
else
return("exists");
Please suggest.
Thanks
Hi,
Your coding needs to be changed. pos you defined as integer and you are using eQuals function(String function) with int.
Try the below code.
if(a.indexOf("RT") == -1)
return("does not exists");
else
return("exists");
if you want to use your same logic, then try the below UDF
int pos = a.indexOf("RT");
if(pos ==-1)
return("does not exists");
else
return("exists");
raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
pos is an integer.
in the comparison - .equals() you are comparing an integer with a string...apples and oranges cannot be compared...
try
if (pos == -1)
Arvind R
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
better way..
if ( a.indexOf("RT") > -1 )
{
return "exists";
}
else
{
return("does not exists");
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.