lundi 27 janvier 2020

Why is my if operator is not working in java? [duplicate]

I'm trying to get rid of a dot, but my if statement is not working. I run a debug and I can clearly see that my last "lettre" is "." but its still read that they are not equal and go in the code.

    String premierMot = phraseInverser[0];
    String[] premierMotDecomposer = premierMot.split("(?!^)");
    premierMotDecomposer[0] = premierMotDecomposer[0].toUpperCase();
    premierMot = "";
    for(String lettre : premierMotDecomposer)
    {
        if(lettre != ".") 
        {
            premierMot += lettre;
        }
    }

Aucun commentaire:

Enregistrer un commentaire