- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 check if a String contains another String in a case insensitive manner 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
- Related Articles
- How to test if a Java String contains a case insensitive regex pattern
- Method to check if a String contains a sub string ignoring case 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 do I determine if a String contains another String in Java?
- How to check if a string contains only lower case letters in Python?
- How to check if a string contains only upper case letters in Python?
- How to check if a string contains a specific sub string?
- Check if a string contains a sub-string in C++
- Java Program to Check if a string contains a substring
- Check if a string contains a number using Java.
- How to check if a string contains a substring in Golang?
- Case-insensitive string comparison in C++
- Java Regular expression to check if a string contains alphabet
- How to check if a string is a subset of another string in R?

Advertisements