I have a method that gets Enum by string value, but that method is case-sensitive and does not tolerate white spaces. How can I solve it?

```
enum MyEnum {
    ID("ID"), NEW_CODE("new code"), VALUES("values");
}

public static <T extends Enum<T>> T 
    getEnumFromString(Class<T> c, String string) {
    if (c != null && string != null) {
        try {
            return Enum.valueOf(c, string);
        } catch (IllegalArgumentException ex) {
            //If no enum value was not found
        }
    }
    return null;
}

```