java - to check that string should not be empty -


i reading csv file , have check string should not empty in text file , using approach

if (str == null || str.trim().length() == 0 ) {             return false; 

now text file contain record

aaa bbb ccc   adr ytr tru  wsu eit ifd  wer ert ref 

now putting break point in piece of cose want test case of string empty 1 should need in text file , shall remove row shown below please advise

aaa bbb ccc  adr ytr tru   wer ert ref 

i taking complete string input ex sting t = fhgfgffjfufjk

although using str == null || str.trim().isempty() valid, may consider using apache commons lang allow do:

if (stringutils.isblank(str)) 

for which, imho, more readable.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -