how to use ignore case in java

Solutions on MaxInterview for how to use ignore case in java by the best coders in the world

showing results for - "how to use ignore case in java"
Daniele
25 Feb 2019
1You have to use the String method .toLowerCase() or .toUpperCase() on both the input and the string you are trying to match it with.
2
3Example:
4
5public static void findPatient() {
6    System.out.print("Enter part of the patient name: ");
7    String name = sc.nextLine();
8
9    System.out.print(myPatientList.showPatients(name));
10}
11
12//the other class
13ArrayList<String> patientList;
14
15public void showPatients(String name) {
16    boolean match = false;
17
18    for(String matchingname : patientList) {
19        if (matchingname.toLowerCase().contains(name.toLowerCase())) {
20            match = true;
21        }
22    }
23}
queries leading to this page
case ignore in javacontains ignore case java ignore case javsstring ignore case java contains ignore case javaif statement ignore case javacommand contains ignore case in javawhat does ignore case mean in javawhat is ignore case in javaignore casensitve javachar ignore case javadoes endswith have case ignore case in javahow to ignore case sensitive in javahow to ignorecase in javajava string conains ignore casejava character ignore casejava string ignore casehow to ignore case in loop in javaignore case javacontains with ignore case javahow to use ignore case in java in switch statementignore case sensitive in java ignorecase method in javajava ends with ignore casecontains with ignore case in javajava how to ignore the casingwhat is case insensitive in java ignorecase javajava ignore case containsignore case in contains javajava pattern ignore caseignore case contains javaignore case in java charjava contains ignore casejava matches ignore casejava ignorecaseignore case string javachar ignore case in javaresult of uppercase ignore case in javacontains will ignore case 2b javacontains method with ignore case in javajava startswith ignore casehow to ignore case in javawhat not eqaul to ignore upper case in javaignorecase in javajava 8 switch ignore casejava string switch ignore casejava string compare case ignoreignore case package javahow to ignore casing javaswitch ignore case javacontains ignore case in javaignore case in javajava ignorecase examplehow to use contains with ignore case in javaignore equal case in javacase insensitive in javacharacter ignore case javajava ignore caseignore case javaccpattern ignore case javaignorecase java string ignore case javaignorecase javacharacter ignore case in javajava has ignore caseignore case switch statement javajava string ignore case sensitivecompare to ignore case in javahow to make something not case sensitive in javaisequal ignore case javahow to use ignore case in javaignore case for char in javaequal to ignore case javaignore case java charswitch case ignore case javacontaiins ignore case javacase insensitive javaignore case in java containsignore case for string in javaignore equals case javajava ignorecasehow to use ignore case in java