Sdílet prostřednictvím


Byte.ValueOf Method

Definition

Overloads

ValueOf(SByte)

Returns a Byte instance representing the specified byte value.

ValueOf(String, Int32)

Returns a Byte object holding the value extracted from the specified String when parsed with the radix given by the second argument.

ValueOf(String)

Returns a Byte object holding the value given by the specified String.

ValueOf(SByte)

Returns a Byte instance representing the specified byte value.

[Android.Runtime.Register("valueOf", "(B)Ljava/lang/Byte;", "")]
public static Java.Lang.Byte ValueOf (sbyte b);
[<Android.Runtime.Register("valueOf", "(B)Ljava/lang/Byte;", "")>]
static member ValueOf : sbyte -> Java.Lang.Byte

Parameters

b
SByte

a byte value.

Returns

a Byte instance representing b.

Attributes

Remarks

Returns a Byte instance representing the specified byte value. If a new Byte instance is not required, this method should generally be used in preference to the constructor #Byte(byte), as this method is likely to yield significantly better space and time performance since all byte values are cached.

Added in 1.5.

Java documentation for java.lang.Byte.valueOf(byte).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

ValueOf(String, Int32)

Returns a Byte object holding the value extracted from the specified String when parsed with the radix given by the second argument.

[Android.Runtime.Register("valueOf", "(Ljava/lang/String;I)Ljava/lang/Byte;", "")]
public static Java.Lang.Byte ValueOf (string s, int radix);
[<Android.Runtime.Register("valueOf", "(Ljava/lang/String;I)Ljava/lang/Byte;", "")>]
static member ValueOf : string * int -> Java.Lang.Byte

Parameters

s
String

the string to be parsed

radix
Int32

the radix to be used in interpreting s

Returns

a Byte object holding the value represented by the string argument in the specified radix.

Attributes

Exceptions

if string can not be parsed as a byte value, or radix Character.MAX_RADIX.

Remarks

Returns a Byte object holding the value extracted from the specified String when parsed with the radix given by the second argument. The first argument is interpreted as representing a signed byte in the radix specified by the second argument, exactly as if the argument were given to the #parseByte(java.lang.String, int) method. The result is a Byte object that represents the byte value specified by the string.

In other words, this method returns a Byte object equal to the value of:

<blockquote> new Byte(Byte.parseByte(s, radix))</blockquote>

Java documentation for java.lang.Byte.valueOf(java.lang.String, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

  • <xref:Java.Lang.Byte.ParseByte(System.String%2c+System.Int32)>

Applies to

ValueOf(String)

Returns a Byte object holding the value given by the specified String.

[Android.Runtime.Register("valueOf", "(Ljava/lang/String;)Ljava/lang/Byte;", "")]
public static Java.Lang.Byte ValueOf (string s);
[<Android.Runtime.Register("valueOf", "(Ljava/lang/String;)Ljava/lang/Byte;", "")>]
static member ValueOf : string -> Java.Lang.Byte

Parameters

s
String

the string to be parsed

Returns

a Byte object holding the value represented by the string argument

Attributes

Exceptions

if string can not be parsed as a byte value.

Remarks

Returns a Byte object holding the value given by the specified String. The argument is interpreted as representing a signed decimal byte, exactly as if the argument were given to the #parseByte(java.lang.String) method. The result is a Byte object that represents the byte value specified by the string.

In other words, this method returns a Byte object equal to the value of:

<blockquote> new Byte(Byte.parseByte(s))</blockquote>

Java documentation for java.lang.Byte.valueOf(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

Applies to