Rename the parameter "value" to "number": the javadoc @param is renamed
to numberr.
Trying with other names "aaa" also doesn't work right.
Ah.
New name shortest than the original: characters are eaten after the
name.
New name longest than the original: characters from the new name are
duplicated.
/**
* Convert a String to a Number.
* <p>
* TODO: another method that uses DecimalFormat and the current
* dfs symbols to determine what is the decimal point
* TODO: return an appropriate Integer/Long/BigInteger as necessary
*
* @param value to convert
* @return a BigDecimal if the String has a decimal point, a Long
otherwise
* @throws NumberFormatException when "value" is a malformed number
*/
public static final Number toNumber(final String value) throws
NumberFormatException {
if (value.indexOf('.') == -1) {
return Long.valueOf(value);
}
else {
return new BigDecimal(value);
}
}
Carlos
--
Carlos Costa e Silva <[EMAIL PROTECTED]>
_______________________________________________
Eap-list mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-list