public static <E extends Enum<E>> E getEnumIgnoreCaseAndSpecialChars(final Class<E> enumClass, final String enumName, final E defaultEnum) {
        if (enumName == null || !enumClass.isEnum()) {
            return defaultEnum;
        }
        for (final E each : enumClass.getEnumConstants()) {
            if (isEqualIgnoreCaseAndSpecialChars(each.name(), enumName)) {
                return each;
            }
        }
        return defaultEnum;
    }
Shortens a given text to a maximum given number of characters. In case the text is too long it
is shortened according to a given begin-end-distribution-value. Deleted text part is marked with '...'

@param text                 text to shorten. If text is shorter than maxLength it remains unchanged
@param maxLength            maxLength to shorten text to.
@param beginEndDistribution begin-end-distribution to obey on shortening. If >=1 then text is shortened at the end.
                            If <=0 then text is shortened at the beginning. If between 0-1 then text is shortened at beginning and end in relation to this value.
@return the shortened text
main/src/main/java/cgeo/geocaching/utils/TextUtils.java