Checking if a string contains a dot
You only need
s.contains (".");
contains()
method of String class does not take regular expression as a parameter, it takes normal text.
String s = "test.test";
if(s.contains("."))
{
System.out.println("string contains dot");
}
String#contains
receives a plain CharacterSequence
e.g. a String
, not a regex. Remove the \\
from there.
String s = "test.test";
if (s.contains(".")) {
System.out.println("string contains dot");
}