What I want to do is compare to my current operator +
or any other arithmetic operator with any of the operators that I have previously that are also arithmetic,
I have 4+-
, this here is wrong so I want to make it detect if there is a sign before already written do not do anything to me and send error.
remover=txtResultado.getText().toString();
String substringCadena=remover.substring(0,remover.substring.lenght-1);
if (elemento.toString().equals(substringCadena)) {
Toast toast = Toast.makeText(this, "No puede haber dos operadores consecutivos", Toast.LENGTH_SHORT);
toast.show();
contaOp=0;
return;
}
The problem with that is that if I have ++
the error is going to mark me, but if I have +-
the error does not mark me and it is because they are not the same. so how do I make this possible?