string.contains()

String.contains() search for matching sequnce of string
Syntax
String1.contains(String2)
The output is boolean ( true or false )

Here are some examples with output.
String my_str1="Welcome to plus2net";
System.out.println(my_str1.contains("2")); // true
System.out.println(my_str1.contains("net")); // true
System.out.println(my_str1.contains("plus2net")); // true
System.out.println(my_str1.contains("co")); // true
System.out.println(my_str1.contains("no")); // false
Searching for @ and . inside email address.
String my_str1="userid@example.com";
System.out.println(my_str1.contains("@")); // true
System.out.println(my_str1.contains(".")); // true
System.out.println(my_str1.contains(" ")); // false


All String functions
Java

Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com






    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer