Skip to Content
0
Jun 26, 2009 at 08:05 AM

Check Value In UDF

41 Views

Hi,

I am using a UDF to take substring of my value from source (source value is of format abcd/xyz). Now I want to check if there exists any value before "/" i.e. I want to check if there is any value before "/" . I tried using the .length function, but due to some reason I am not able to get it working. So please tell me how to get the below UDF working:

public String getUser1Id(String Id, Container container) throws StreamTransformationException{

String logName = Id;

int len = logName.indexOf("/");

logName = logName.substring(0,len);

return logName;

Id is the input from the source (abcd/xyz) into the UDF.

Thanks.