public class StringContain extends UDF
{public static String evaluate(String im,String drugs)
{String rltString="";List drugList = Arrays.asList(drugs.trim().split(","));
for(String idString : drugList){
if(im.contains(idString)){
if(rltString.isEmpty()){
rltString=idString;
}else{
rltString=rltString+","+idString;
}
}
}
System.out.println(rltString);
return rltString.trim();
}
public static void main(String[] args){
String c1="生理性海水鼻腔護(hù)理噴霧器(兒童),鹽酸金霉素眼膏 硝呋太爾制霉素陰道軟膠囊";
String c2="徐峰";
String aString = evaluate(c1,c2);
System.out.println("=="+aString);
}
}