All pastes #18554 Raw Edit

Stuff

public text v1 · immutable
#18554 ·published 2005-07-26 19:39 UTC
rendered paste body
	protected Number getNumber(String value, Object template)
	{
		if (value.charAt(0) == '#') {// table by level
			if (template instanceof L2Skill)
				return getTableValue(value);
			else if (template instanceof Integer)
				return getTableValue(value, ((Integer)template).intValue());
			else
				throw new IllegalStateException();
		}
		if (value.indexOf('.') == -1)
		{
			int radix = 10;
			if (value.length() > 2 && value.substring(0, 2).equalsIgnoreCase("0x")) {
				value = value.substring(2);
				radix = 16;
			}
			return Integer.valueOf(value, radix);
		}
		return Double.valueOf(value);
	}