Transform a string into an enum (using its name which is supposed to be
uppercase, handles null values.
508156
private static <T extends Enum<T>> T stringToEnum(String value, Class<T> type) {
		final String s = blankToNull(value);
		return value == null ? null : Enum.valueOf(type, s.toUpperCase());
	}
1006858
private static String upperCaseIndexString(String iiopName) {
        StringBuilder StringBuilder = new StringBuilder();
        for (int i = 0; i < iiopName.length(); i++) {
            char c = iiopName.charAt(i);
            if (Character.isUpperCase(c)) {
                StringBuilder.append('_').append(i);
            }
        }
        return StringBuilder.toString();
    }
303597
def as_enum(enum):
    
    if isinstance(enum, string_types):
        try:
            enum = getattr(gl, 'GL_' + enum.upper())
        except AttributeError:
            try:
                enum = _internalformats['GL_' + enum.upper()]
            except KeyError:
                raise ValueError('Could not find int value for enum %r' % enum)
    return enum
943239
private String
sanitize(String str) {
	if (wordcase == CASE_UPPER)
		return str.toUpperCase();
	else if (wordcase == CASE_LOWER)
		return str.toLowerCase();
	return str;
}
651253
def convert_enum(func):
    

    @wraps(func)
    def inner(self, value):
        try:
            if self.check_value(value.value):
                return value.value
            return func(self, value.value)
        except AttributeError:
            pass

        return func(self, value)

    return inner
1342447
public static String cleanNameForJavaEnum(String enumConstant) {
		if (!StringUtils.hasText(enumConstant)) {
			return enumConstant;
		}

		List<String> nameGroups = new ArrayList<>(asList(splitByCharacterTypeCamelCase(enumConstant)));

		nameGroups.removeIf(s -> containsOnly(s.replaceAll(ILLEGAL_CHARACTER_REGEX, "_"), "_"));

		String enumName = upperCase(join(nameGroups, "_"));
		if (isEmpty(enumName)) {
			enumName = "_DEFAULT_";
		} else if (Character.isDigit(enumName.charAt(0))) {
			enumName = "_" + enumName;
		}

		return filterKeywords(enumName);
	}
1336698
public static String getNullAsValue(String input, String value) {
    return (input == null) ? value : input;
  }
256176
def to_nullable_string(value):
        
        if value == None:
            return None
        if type(value) == datetime.date:
            return value.isoformat()
        if type(value) == datetime.datetime:
            if value.tzinfo == None:
                return value.isoformat() + "Z"
            else:
                return value.isoformat()

        if type(value) == list:
            builder = ''
            for element in value:
                if len(builder) > 0:
                    builder = builder + ","
                builder = builder + element
            return builder.__str__()
        return str(value)
952523
def _convert_string_to_native(value):
    """"""
    result = None

    try:
        result = ast.literal_eval(str(value))
    except (SyntaxError, ValueError):
        # Likely a string
        result = value.split(',')
    return result
274339
@NullSafe
  public static String trim(String value) {
    return value != null ? value.trim() : null;
  }
1081362
function (fromString) {
                    var matches = fromString.match(/(\${.*?})/g);
                    if (matches != null) {
                        for (var i = 0; i < matches.length; i++) {
                            var val = values[matches[i].substring(2, matches[i].length - 1)] || "";
                            if (val != null) {
                                fromString = fromString.replace(matches[i], val);
                            }
                        }
                    }
                    return fromString;
                }
1155517
function standardize(value) {
  var isString = _.isString(value);
  value = utils.standardizeInput(value);
  return (isString && value === null) ? "" : value;
}
1275272
static boolean isBadCase(String name)
    {
        EnumItem<NR> nrEnumItem = dictionary.get(name);
        if (nrEnumItem == null) return false;
        return nrEnumItem.containsLabel(NR.A);
    }
1198014
function glEnumToString(value) {
  checkInit();
  var name = glEnums[value];
  return (name !== undefined) ? name :
      ("*UNKNOWN WebGL ENUM (0x" + value.toString(16) + ")");
}
517571
function toCamel(string) {
        if (string === null || string === undefined) {
            return "";
        }
        return String(string).replace(/((\s|\-|\.)+[a-z0-9])/g, function($1) {
            return $1.toUpperCase().replace(/(\s|\-|\.)/g, "");
        });
    }
770905
@Override
	protected R parseValueFromString(String value)
	{


        value = value.replaceAll("-", "_");
        value = value.replaceAll("^\\s+","");
        value = value.replaceAll("\\s+$","");
		return (R)Enum.valueOf(this.getRange(), value);
	}
887325
public static String toCapCase( final String string )
    {
        if ( string == null )
        {
            return null;
        }

        if( string.length() == 1 )
        {
            return string.toUpperCase();
        }

        return Character.toUpperCase( string.charAt( 0 ) ) + string.substring( 1 ).toLowerCase();
    }