As Mentioned by ifLoop, equalsIgnoreCase() should work. Also the check for Driver.customers[index]!=null should not be as part of For check because the loop will terminate if any of the records returns null, giving an impression that the id is not found. But in reality, there can be a record after that null record, matching the condition. Better still, we should make sure the Customer Array never have a record which is null.
public int getCustomer(String IdToFind){
if(Driver.customers.length > 0) {
for (int index = 0; index<Driver.customers.length;index++){
if (Driver.customers[index].getCustomerID().equalsIgnoreCase(IdToFind))
return index; //ID found
}
return -1; //ID not found
} else {
return -1 //ID not found, as no customers in driver object
}
}