java string contains substring

String contains() Java

Existence of a substring in the main string can be checked with String contains() method. public class Demo { public static void main(String args[]) { String str1 = “abcdefghi”; // string (main string) String str2 = “def”; // another string (substring) String str3 = “ded”; // another string (substring) boolean b = str1.contains(str2); // checks …

String contains() Java Read More »