Sanitizes a name by replacing every not alphanumeric character with '_'

@param name the name of the offerings
@return the sanitized name
972410
public static String sanitizeName(String name) {

        if (name  == null)
            throw new NullPointerException("Parameter name cannot be null");

        name = name.trim();

        if (name.length() == 0)
            throw new IllegalArgumentException("Parameter name cannot be empty");

        StringBuilder ret = new StringBuilder("");

        for (int i = 0; i < name.length(); i++) {
            char ch = name.charAt(i);
            if (Character.isLetter(ch) || Character.isDigit(ch)) {
                ret.append(ch);
            } else {
                ret.append("_");
            }

        }

        return ret.toString();
    }
1256352
private static String checkName(String name) {
        if (name == null)
            return "null";

        int len = name.length();
        if (len == 0)
            return "\"\"";

        int cc = '/';
        int cp;
        for (int k = 0; k < len; k += Character.charCount(cp)) {
            cp = name.codePointAt(k);
            if ((cc == '/' && !Character.isJavaIdentifierStart(cp))
                    || (cp != '/' && !Character.isJavaIdentifierPart(cp))) {
                return "\"" + addEscapes(name) + "\"";
            }
            cc = cp;
        }

        return name;
    }
798589
public static String removeNonJavaIdentifierCharacters( String name )
    {
        StringBuilder javaIdentifier = new StringBuilder();
        
        for (int index = 0; index < name.length(); index++)
        {
        	if (Character.isJavaIdentifierPart(name.codePointAt( index ))) {
        		javaIdentifier.append(name.charAt(index));
        	}
        }

        return javaIdentifier.toString();
    }
1251568
public static String stripGetterPrefix(String name) {
        if (StringUtils.isBlank(name)) {
            return name; // This should never happen.
        }
        String[] mName = StringUtils.splitByCharacterTypeCamelCase(name);
        StringBuilder sb = new StringBuilder();
        for (int i = 1; i < mName.length; i++) {
            sb.append(mName[i]);
        }
        return StringUtils.uncapitalize(sb.toString());
    }
729658
private static String normalize(String name)
  {
    CharBuffer cb = new CharBuffer();

    int len = name.length();
    for (int i = 0; i < len; i++) {
      char ch = name.charAt(i);

      if (Character.isLowerCase(ch))
        cb.append(Character.toUpperCase(ch));
      else if (ch == '_')
        cb.append('-');
      else
        cb.append(ch);
    }

    return cb.close();
  }
174087
function nameToKey(name) {
  return name.replace(/([a-z])([A-Z])/g, (a, b, c) => b + '-' + c.toLowerCase()).toLowerCase();
}
443553
public static String simpleName(String name) {
		if (name == null) {
			return null;
		}
		final int index = name.lastIndexOf('.');
		if (index > 0) {
			return name.substring(index + 1);
		}
		return name;
	}
146073
public static String quoteWrap(String name) {
		String quoteName = null;
		if (name != null) {
			if (name.startsWith("\"") && name.endsWith("\"")) {
				quoteName = name;
			} else {
				quoteName = "\"" + name + "\"";
			}
		}
		return quoteName;
	}
953841
public static String convertUnderscoreNameToClassName(String name) {
        StringBuffer result = new StringBuffer();
        boolean nextIsUpper = false;

        if (name != null) {
            int len = name.length();

            if (len > 0) {
                String s = String.valueOf(name.charAt(0));

                result.append(s.toUpperCase());

                for (int i = 1; i < len; i++) {
                    s = String.valueOf(name.charAt(i));

                    if ("_".equals(s)) {
                        nextIsUpper = true;
                    } else {
                        if (nextIsUpper) {
                            result.append(s.toUpperCase());
                            nextIsUpper = false;
                        } else {
                            result.append(s.toLowerCase());
                        }
                    }
                }
            }
        }

        return result.toString();
    }
1270811
public static String normalizeHostName(String name) {
		if (Character.digit(name.charAt(0), 16) != -1) { // it is an IP
			return name;
		} else {
			try {
				InetAddress ipAddress = InetAddress.getByName(name);
				return ipAddress.getHostAddress();
			} catch (UnknownHostException e) {
				return name;
			}
		}
	}
175143
public static boolean isValidNcName( String name ) {
        if (name == null || name.length() == 0) return false;
        CharacterIterator iter = new StringCharacterIterator(name);
        char c = iter.first();
        if (!isValidNcNameStart(c)) return false;
        while (c != CharacterIterator.DONE) {
            if (!isValidNcName(c)) return false;
            c = iter.next();
        }
        return true;
    }
1096676
public static String camel2Underscore(@Nullable final String name) {
        if (name == null) {
            return null;
        }
        return name.replaceAll("(.)(\\p{Upper})", "$1_$2").toLowerCase();
    }
975398
public static String cleanNameWithAccents( String name ) {

		String temp = Normalizer.normalize( name, Normalizer.Form.NFD );
		Pattern pattern = Pattern.compile( "\\p{InCombiningDiacriticalMarks}+" );
		return pattern.matcher( temp ).replaceAll( "" ).trim();
	}
158086
public static String toSafeFileName(String name) {
        int size = name.length();
        StringBuilder builder = new StringBuilder(size * 2);
        for (int i = 0; i < size; i++) {
            char c = name.charAt(i);
            boolean valid = c >= 'a' && c <= 'z';
            valid = valid || (c >= 'A' && c <= 'Z');
            valid = valid || (c >= '0' && c <= '9');
            valid = valid || (c == '_') || (c == '-') || (c == '.');

            if (valid) {
                builder.append(c);
            } else {
                // Encode the character using hex notation
                builder.append('x');
                builder.append(Integer.toHexString(i));
            }
        }
        return builder.toString();
    }
162334
public static String quoteName(String name) {
        StringBuilder sb = new StringBuilder();

        int len = name.length();
        for (int i = 0; i < len; i++) {
            char c = name.charAt(i);

            if (c == '\\' || c == '"') {
                sb.append('\\');
            }

            sb.append(c);
        }

        return sb.toString();
    }
1360649
public static final String idFromName(String name) {
        Transliterator tr = Transliterator.getInstance("Any-Latin; Latin-ASCII"); //$NON-NLS-1$
        return removeNonWord(tr.transliterate(name));
    }
350604
protected function cleanName(string $name) : string
    {
        if ('._ids' === substr($name, -5)) {
            $name = substr($name, 0, -5);
        }

        if (false !== strpos($name, '.')) {
            $fieldElements = explode('.', $name);
            $name = false !== end($fieldElements) ? end($fieldElements) : $name;
        }

        if (substr($name, -3) === '_id') {
            $name = substr($name, 0, -3);
        }
        $name = Inflector::humanize(Inflector::underscore($name));

        return $name;
    }