- 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 do I determine if a String contains another String 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 check if a String contains another String in a case insensitive manner in Java?
- Check if string contains another string in Swift
- How do we check if a String contains a substring (ignoring case) in Java?
- How to test if a string contains specific words in Java?
- Determine if a String is a legal Java Identifier
- Method to check if a String contains a sub string ignoring case in Java
- Check if a string contains a number using Java.
- How to check if a string contains a specific sub string?
- How to find If a given String contains only letters in Java?
- Insert a String into another String in Java
- Check if a string contains a sub-string in C++
- How do I identify if a string is a number in C#?
- Return true or false in a MySQL select if another field contains a string?
- Java Program to Check if a string contains a substring
- How can we check if specific string occurs multiple times in another string in Java?

Advertisements