- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to test if a string contains specific words in Java?
The java.lang.String.contains() method returns true if and only if this string contains the specified sequence of char values.
Example
public class Sample { public static void main(String args[]){ String str = "Hello how are you welcome to tutorialspoint"; String test = "tutorialspoint"; Boolean bool = str.contains(test); System.out.println(bool); } }
Output
true
- Related Articles
- How to test if a Java String contains a case insensitive regex pattern
- How to check if a string contains a specific sub string?
- How to parse for words in a string for a specific word in java?
- How to check if the string contains the specific word?
- Python Program to Test if string contains element from list
- How do I determine if a String contains another String in Java?
- How to find If a given String contains only letters in Java?
- How to check if any of the strings in a column contains a specific string in MySQL?
- How to check if a String contains another String in a case insensitive manner in Java?
- Java Program to Check if a string contains a substring
- Method to check if a String contains a sub string ignoring case in Java
- Java Program to validate if a String contains only numbers
- Java Regular expression to check if a string contains alphabet
- How to check if the string begins with specific substring in Java?
- How to check if the string ends with specific substring in Java?

Advertisements