This code is logically correct.. but it's not working...
int operatorIndex;
String str = "25+45";
if((operatorIndex = str.indexOf(str.indexOf("+") < str.indexOf("-") ? "+": "-")) != -1){
System.out.println("works!");
}
System.out.println(operatorIndex); //-1
Aucun commentaire:
Enregistrer un commentaire