
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Check if a String Contains Another String Case Insensitively in Java
One way to do it to convert both strings to lower or upper case using toLowerCase() or toUpperCase() methods and test.
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.toLowerCase().contains(test.toLowerCase()); System.out.println(bool); } }
Output
true
Advertisements