if (key.equals ("1") || key.equals ("Circle")){
how can i make this statement true even if I enter the string "CiRcle" or "circle"? I mean at different cases.
if (key.equals ("1") || key.equals ("Circle")){
how can i make this statement true even if I enter the string "CiRcle" or "circle"? I mean at different cases.
You can try as below :
if (key.equals ("1") || key.equalsIgnoreCase("Circle")){
The general syntax is
public boolean equalsIgnoreCase(String anotherString)
This method returns true if the argument is not null and the Strings are equal, ignoring case; false otherwise.
For your case
if (key.equals("1") || key.equalsIgnoreCase("Circle"))
You can try
if (key.equals ("1") || key.equalsIgnoreCase ("Circle"))
However it seems like you did not have any research or studied String methods in java. I recommend you to look at String topic in java