Constructs an {@link ItemStack} from a string in the format modid:itemName@damagexstackSize.

@param str the str
@return the item
429808
public static ItemStack getItemStack(String str)
	{
		Matcher matcher = pattern.matcher(str);
		if (!matcher.find())
			return ItemStack.EMPTY;

		String itemString = matcher.group("item");
		if (itemString == null)
			return ItemStack.EMPTY;

		String modid = matcher.group("modid");
		if (modid == null)
			modid = "minecraft";

		int damage = 0;
		String strDamage = matcher.group("damage");
		if (strDamage != null)
			damage = strDamage.equals("*") ? OreDictionary.WILDCARD_VALUE : Silenced.get(() -> Integer.parseInt(matcher.group("damage")));
		int size = matcher.group("size") == null ? 1 : Silenced.get(() -> Integer.parseInt(matcher.group("size")));
		if (size == 0)
			size = 1;

		Item item = Item.getByNameOrId(modid + ":" + itemString);
		if (item == null)
			return ItemStack.EMPTY;

		return new ItemStack(item, size, damage);
	}
291148
public static Float parseFloat(final String str) {
        if (null != str) {
            try {
                return new Float(Float.parseFloat(str.trim()));
            } catch (final Exception e) {
                // :IGNORE:
            }
        }
        return null;
    }
1092206
public static String stringByDeletingLastPathComponent(final String str) {
        String path = str;
        int start = str.length() - 1;
        while (path.charAt(start) == '/') { start--; }

        final int index = path.lastIndexOf('/', start);
        path = (index < 0) ? "" : path.substring(0, index);


        if (path.length() == 0 && str.charAt(0) == '/') { return "/"; }

        return path;
    }
1328869
public static String toReadableForm(String str)
    {
        String ret = str;
        if(str != null && str.length() > 0 
            && str.indexOf("\n") != -1 
            && str.indexOf("\r") == -1)
        {
            str.replaceAll("\n", "\r\n");
        }

        return ret;
    }
137137
public static String requireNotEmpty(final String str) throws NullPointerException, IllegalArgumentException {
	if (str.length() == 0) {
	    throw new IllegalArgumentException();
	}
	return str;
    }
1264049
public static String capitalize(final String str) {
        final int strLen;
        if(str == null || (strLen = str.length()) == 0) {
            return str;
        }

        return new StringBuilder(strLen)
            .append(String.valueOf(str.charAt(0)).toUpperCase())
            .append(str.substring(1))
            .toString();
    }
1370331
public StrBuilder append(final StrBuilder str) {
        if (str == null) {
            return appendNull();
        }
        final int strLen = str.length();
        if (strLen > 0) {
            final int len = length();
            ensureCapacity(len + strLen);
            System.arraycopy(str.buffer, 0, buffer, len, strLen);
            size += strLen;
        }
        return this;
    }
430875
public static String toLowerFirstChar(final String str)
    {
        return Character.toLowerCase(str.charAt(0)) + str.substring(1);
    }
613695
public static String initCap(String str) {
        assertStringNotNull(str);
        if (is_Null_or_Empty(str)) {
            return str;
        }
        if (str.length() == 1) {
            return str.toUpperCase();
        }
        final char chars[] = str.toCharArray();
        chars[0] = Character.toUpperCase(chars[0]);
        return new String(chars);
    }
921866
public String toTrad(String str) {   
		char[] c = str.toCharArray();
		for (int i = 0; i < str.length(); i++) {   
			char cc = s2l.get(c[i]);
			if (cc != 0) {   
				c[i] = cc;   
			} 
		}   
		return new String(c);   
	}
901791
public static String convertArrayToStr(Object[] str){
        StringBuilder sql = new StringBuilder();
        for(Object s : str){
            sql.append(",'").append(s).append("'");
        }
        return org.apache.commons.lang3.ArrayUtils.toString(sql).substring(1,sql.length());
    }
1201093
function(str) {
    var tag = /#([a-z]+)\{|\}/,
        cstack = [],
        matches = null,
        orig = null,
        name = null,
        code = null;

    while (tag.test(str)) {
        matches = tag.exec(str);
        orig = matches[0];

        if (console.isColored()) {
            if (orig === '}') {
                cstack.pop();
            } else {
                name = matches[1];
                if (name in _ANSICODES) {
                    code = _ANSICODES[name];
                    cstack.push(code);
                }
            }

            str = str.replace(orig, _ANSICODES.reset + cstack.join(''));
        } else {
            str = str.replace(orig, '');
        }
    }
    return str;
}
912004
public static StringBuilder createStackTrace(StringBuilder s, StackTraceElement[] stack) {
		if (stack != null)
			for (StackTraceElement e : stack) {
				s.append("\n\tat ");
				s.append(e.getClassName());
				if (e.getMethodName() != null) {
					s.append('.');
					s.append(e.getMethodName());
				}
				if (e.getFileName() != null) {
					s.append('(');
					s.append(e.getFileName());
					s.append(':');
					s.append(e.getLineNumber());
					s.append(')');
				}
			}
		return s;
	}
461688
public ItemStack extract(int amount)
	{
		ItemStackSplitter iss = new ItemUtils.ItemStackSplitter(getItemStack());
		iss.split(amount);
		setItemStack(iss.source);
		//if (hasChanged())
		onSlotChanged();
		return iss.split;
	}
490099
public static String replaceCrLfTab(final String str) {
        if (str == null) {
            return null;
        }
        final int len = str.length();
        final StringBuilder sb = new StringBuilder();
        int i = 0;
        while (i < len) {
            final char ch = str.charAt(i++);
            if (ch == '\\') {
                if (i < len) {
                    final char next = str.charAt(i);
                    final Character replacement = SPECIAL_CHAR_REPLACEMENT_MAP.get(next);
                    if (replacement != null) {
                        sb.append(replacement);
                        i++;
                    } else {
                        sb.append(ch);
                    }
                } else {
                    sb.append(ch);
                }
            } else {
                sb.append(ch);
            }
        }
        return sb.toString();
    }
873241
def _get_var_from_string(item):
    
    modname, varname = _split_mod_var_names(item)
    if modname:
        mod = __import__(modname, globals(), locals(), [varname], -1)
        return getattr(mod, varname)
    else:
        return globals()[varname]
537750
public static String rtrim(String str, String defaultValue) {
	if (str == null) return defaultValue;
	int len = str.length();

	while ((0 < len) && (str.charAt(len - 1) <= ' ')) {
	    len--;
	}
	return (len < str.length()) ? str.substring(0, len) : str;
    }