I know that there are many such questions. But I really could not find anything that could solve my problem.
I want to check if a string contains a specific input number. See the following example:
public Boolean checkString()
{
string input = "2.5.8.12.30";
string intToFind = "3";
if (input.contains(intToFind))
{
return true;
}
else
{
return false;
}
}
This returns true, but I want it to return false, since the intToFind string has a value of 3, not 30. Thus, the contains () problem is the problem.
How do I search for only 3?
source
share