check string is equal

if ( variable.valueOf()=="string" )

"a" == "b"
However, note that string objects will not be equal.

new String("a") == new String("a")
will return false.

Call the valueOf() method to convert it to a primitive for String objects,

new String("a").valueOf() == new String("a").valueOf()

Tags: