java命名空间java.lang类byte的类成员方法:
decode定义及介绍
本文导语:
decode
public static byte decode(string nm)
throws numberformatexception
将 string 解码为 byte。接受按下列语法给出的十进制、十六进制和八进制数:
decodablestring:
signopt decimalnumeral
signopt 0x hexdigits
signopt 0x hexdigits
signopt # hexdigit...
public static byte decode(string nm)
throws numberformatexception
- 将
string 解码为 byte。接受按下列语法给出的十进制、十六进制和八进制数:
- decodablestring:
- signopt decimalnumeral
- signopt
0x hexdigits
- signopt
0x hexdigits
- signopt
# hexdigits
- signopt
0 octaldigits
- sign:
-
java language specification 的 §3.10.1 中给出了 decimalnumeral、hexdigits 和 octaldigits 的定义。
对(可选)负号和/或基数说明符(“0x”、“0x”、“#” 或前导零)后面的字符序列进行解析就如同使用带指定基数(10、16 或 8)的 byte.parsebyte 方法一样。该字符序列必须表示一个正值,否则将抛出 numberformatexception。如果指定 string 的第一个字符是负号,则结果将被求反。该 string 中不允许出现空白字符。
- 参数:
nm - 要解码的 string。
- 返回:
- 保持由
nm 表示的 byte 值的 byte 对象
- 抛出:
numberformatexception - 如果 string 不包含一个可解析的 byte。- 另请参见:
parsebyte(java.lang.string, int)