I'm trying to figure out whether a string contains an ndash character and if it does I want to replace it with a regular dash. When I try using the contains() method using the raw character the compiler issues a warning and the comparison does not work. So I tried myString.contains("\\x96") which is the hex representation of ndash. No compiler warning but it doesn't work.