简体   繁体   中英

Discard null value in string[] java

I am taking some value by parsing the api and now i want to chek whether if through parsing the value comes null then the value should not be added to the string array and if there is some value then only should be added to the string[]. please help This is my code:

String[] title_array=null;
myparseobj=new XMLParser();
if(myparseobj.xmlParsing(url,"item","title") != null){
    title_array=myparseobj.xmlParsing(url,"item","title");
}

But this is not working please help

myparseobj=new XMLParser();
String val = myparseobj.xmlParsing(url,"item","title");
if(!((val == null)||("null".equalsIgnoreCase(val))){
title_array=myparseobj.xmlParsing(url,"item","title"); }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM