ignore case in java code example
Example: how to use ignore case in java
You have to use the String method .toLowerCase() or .toUpperCase() on both the input and the string you are trying to match it with.
Example:
public static void findPatient() {
System.out.print("Enter part of the patient name: ");
String name = sc.nextLine();
System.out.print(myPatientList.showPatients(name));
}
ArrayList<String> patientList;
public void showPatients(String name) {
boolean match = false;
for(String matchingname : patientList) {
if (matchingname.toLowerCase().contains(name.toLowerCase())) {
match = true;
}
}
}