java.lang.NumberFormatException.forInputString()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(191)

本文整理了Java中java.lang.NumberFormatException.forInputString()方法的一些代码示例,展示了NumberFormatException.forInputString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NumberFormatException.forInputString()方法的具体详情如下:
包路径:java.lang.NumberFormatException
类名称:NumberFormatException
方法名:forInputString

NumberFormatException.forInputString介绍

[英]Factory method for making a NumberFormatException given the specified input which caused the error.
[中]在给定导致错误的指定输入的情况下,用于生成NumberFormatException的工厂方法。

代码示例

代码示例来源:origin: stackoverflow.com

digit = Character.digit(s.charAt(i++),radix);
if (digit < 0) {
  throw NumberFormatException.forInputString(s);
} else {
  result = -digit;
  throw NumberFormatException.forInputString(s);
  throw NumberFormatException.forInputString(s);
  throw NumberFormatException.forInputString(s);
throw NumberFormatException.forInputString(s);
return result;
} else {    /* Only got "-" */
throw NumberFormatException.forInputString(s);

代码示例来源:origin: stackoverflow.com

if (result < multmin) {
  throw NumberFormatException.forInputString(s);
}

代码示例来源:origin: stackoverflow.com

String input = "123hello";
double d = parseDouble(input); // Runtime Error

public double parseDouble(String input, DecimalFormat format) throws NumberFormatException
{
  if (input.equals("-") || input.equals("-."))
    throw NumberFormatException.forInputString(input);
  if (!input.matches("\\-?[0-9]*(\\.[0-9]*)?"))
    throw NumberFormatException.forInputString(input);

  // From here, we are sure it is numeric.
  return format.parse(intput, new ParsePosition(0));
}

代码示例来源:origin: stackoverflow.com

arg5 = MIN_VALUE;
  } else if (arg8 != 43) {
    throw NumberFormatException.forInputString(arg);
    throw NumberFormatException.forInputString(arg);
  arg7 = Character.digit(arg.charAt(arg3++), arg0);
  if (arg7 < 0) {
    throw NumberFormatException.forInputString(arg);
    throw NumberFormatException.forInputString(arg);
    throw NumberFormatException.forInputString(arg);
throw NumberFormatException.forInputString(arg);

代码示例来源:origin: stackoverflow.com

limit = Integer.MIN_VALUE;
  } else if (firstChar != '+')
    throw NumberFormatException.forInputString(s);
    throw NumberFormatException.forInputString(s);
  i++;
    throw NumberFormatException.forInputString(s);
    throw NumberFormatException.forInputString(s);
    throw NumberFormatException.forInputString(s);
throw NumberFormatException.forInputString(s);

代码示例来源:origin: stackoverflow.com

limit = Integer.MIN_VALUE;
  } else if (firstChar != '+')
    throw NumberFormatException.forInputString(s);
    throw NumberFormatException.forInputString(s);
  i++;
    throw NumberFormatException.forInputString(s);
    throw NumberFormatException.forInputString(s);
    throw NumberFormatException.forInputString(s);
throw NumberFormatException.forInputString(s);

代码示例来源:origin: stackoverflow.com

limit = Integer.MIN_VALUE;
  } else if (firstChar != '+')
    throw NumberFormatException.forInputString(s);
    throw NumberFormatException.forInputString(s);
  i++;
    throw NumberFormatException.forInputString(s);
    throw NumberFormatException.forInputString(s);
    throw NumberFormatException.forInputString(s);
throw NumberFormatException.forInputString(s);

代码示例来源:origin: org.apidesign.bck2brwsr/emul.mini

limit = Long.MIN_VALUE;
  } else if (firstChar != '+')
    throw NumberFormatException.forInputString(s);
    throw NumberFormatException.forInputString(s);
  i++;
    throw NumberFormatException.forInputString(s);
    throw NumberFormatException.forInputString(s);
    throw NumberFormatException.forInputString(s);
throw NumberFormatException.forInputString(s);

代码示例来源:origin: stackoverflow.com

digit = Character.digit(s.charAt(i++),radix);
if (digit < 0) {
  throw NumberFormatException.forInputString(s);
} else {
  result = -digit;
  throw NumberFormatException.forInputString(s);
  throw NumberFormatException.forInputString(s);
  throw NumberFormatException.forInputString(s);
throw NumberFormatException.forInputString(s);
return result;
} else {    /* Only got "-" */
throw NumberFormatException.forInputString(s);

代码示例来源:origin: jtulach/bck2brwsr

limit = Long.MIN_VALUE;
  } else if (firstChar != '+')
    throw NumberFormatException.forInputString(s);
    throw NumberFormatException.forInputString(s);
  i++;
    throw NumberFormatException.forInputString(s);
    throw NumberFormatException.forInputString(s);
    throw NumberFormatException.forInputString(s);
throw NumberFormatException.forInputString(s);

相关文章