if statement - Check if 2 string are differents java -
i have problem if condition, have code :
if(!session.getattribute("login").equals(d3.getlogin_demandeur())){ //do }else{ //do else }
so code if session.getattribute("login")
equals d3.getlogin_demandeur()
should go else statement, doesn't work, have printed out these 2 values , same , still go else statement, idea ?
edit :
here how print
system.out.println(session.getattribute("login")+"="+(d3.getlogin_demandeur()));
and have :
smilleto=smilleto
you can use trim()
function remove unwanted spaces , use equalsignorecase()
if don't have case sensitivity criteria.
string login = (string)session.getattribute("login").trim(); string logindemandeur = d3.getlogin_demandeur().trim(); // assuming getlogin_demandeur has return type string. if(!login.equalsignorecase(logindemandeur)){ //do }else{ //do else }
Comments
Post a Comment