java - equals() method is not working with string -


i have string

number="(1234)5678"; 

but if block not executed:

if("(".equals(number.charat(0))) {    system.out.println("ifff"); } else {    system.out.println("out"); } 

how change boolean expression execute if block?

you can try following code:

if(number.startswith("(", 0))     {       system.out.println("ifff");     }     else     {                system.out.println("out");     } 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -