Java String Value Of valueOfIgnoreCase(Class cls, String value)

Here you can find the source of valueOfIgnoreCase(Class cls, String value)

Description

value Of Ignore Case

License

Open Source License

Declaration

public static <E extends Enum<E>> E valueOfIgnoreCase(Class<E> cls, String value)
            throws IllegalArgumentException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static <E extends Enum<E>> E valueOfIgnoreCase(Class<E> cls, String value)
            throws IllegalArgumentException {
        for (E e : cls.getEnumConstants()) {
            if (e.toString().equalsIgnoreCase(value))
                return e;
        }// w  ww.  j  a v  a 2s.  c o  m
        throw new IllegalArgumentException(String.format("Unknown enum.value: ", value));
    }
}

Related

  1. valueOfBoolean(String string)
  2. valueOfBooleanStr(String str)
  3. valueOfEnum(Class enumClass, String value, E defaultValue)
  4. valueOfEnum(final Class type, final String value)
  5. valueOfIC(Class enumType, String aName)
  6. valueOfIgnoreCase(Class enumType, String constantName)
  7. valueOfInteger(final String s, int radix)
  8. valueOfIpv4(String ip)
  9. valueOfLongToString(long[] values)