vendredi 2 novembre 2018

Difference b/n trim().equalsIgnoreCase("") and null [duplicate]

This question already has an answer here:

While going through some older codes in a project I found a if loop as below

String string;
if(string != null && !string.trim().equalsIgnoreCase(" "))
{  
    // Do so and so
} 

What is point of using both null and trim().equalsIgnoreCase(" ")

Doesn't they both are same

Aucun commentaire:

Enregistrer un commentaire