How to check if a string contains the sequences of characters or not using java ?
Contain() Method
- java.lang.String.contains() method searches the sequence of characters in the given string. If sequence of char values are found in this string then print Yes otherwise print No.
Sample Code in Java
/ Java program to demonstrate working
// contains() method
public class Wikitechy {
// Driver code
public static void main(String args[]) {
String s1 = "Welcome to Wikitechy";
if (s1.contains("kite") == true) {
System.out.println("Yes");
}
// prints true
else {
System.out.println("No");
}
}
}
Output
Categorized in:
Tagged in:
Accenture interview questions and answers, Applied Materials interview questions and answers, Atos interview questions and answers, best string library, Capgemini interview questions and answers, CASTING NETWORKS INDIA PVT LIMITED interview questions and answers, CGI Group Inc interview questions and answers, check a string contains the sequences of characters, Chetu interview questions and answers, Ciena Corporation interview questions and answers, Collabera Technologies interview questions and answers, Dell International Services India Pvt Ltd interview questions and answers, FIS Global Business Solutions India Pvt Ltd interview questions and answers, Flipkart interview questions and answers, IBM interview questions and answers, Indecomm Global Services interview questions and answers, Infosys Technologies interview questions and answers, java string contains, javacompare strings, L&T Infotech interview questions and answers, Mphasis interview questions and answers, NetApp interview questions and answers, Oracle Corporation interview questions and answers, PeopleStrong interview questions and answers, Persistent Systems interview questions and answers, RBS India De interview questions and answers, Reliance Industries Ltd interview questions and answers, remaxys infotech interview questions and answers, SAP Labs India Pvt Ltd interview questions and answers, string, string class methods, string functions, string functions in java with examples, string library, string manipulation, string match, string methods, string split, strings substring, Tech Mahindra interview questions and answers, UnitedHealth Group interview questions and answers, Virtusa Consulting Services Pvt Ltd interview questions and answers, Wells Fargo interview questions and answers, Wipro Infotech interview questions and answers