dimanche 18 février 2018

if statement with geting the last character of a String in Android Studio java

My code need the if statement to see the last character of some string but how many time i try nothing happens, that mean the conduction is false !.

my code:

            String zzz = T2.getText().toString();
            String zz = zzz.substring(zzz.length() - 1);

            String oo = "+";
            if ( zz ==  oo){         
                T1.setText(" the result ");
            } 
            ..
            String Add1 = T1.getText().toString();
            AAAA11111 = AAAA11111 + Double.parseDouble(Add1);
            T2.setText(Double.toString(AAAA11111) + " +"); // the last character is "+" and it's what i needed
            ..

Aucun commentaire:

Enregistrer un commentaire