- 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
Advertisements