次の方法で共有


Integer.ToString Method

Definition

Overloads

ToString(Int32, Int32)

Returns a string representation of the first argument in the radix specified by the second argument.

ToString(Int32)

Returns a String object representing the specified integer.

ToString(Int32, Int32)

Returns a string representation of the first argument in the radix specified by the second argument.

[Android.Runtime.Register("toString", "(II)Ljava/lang/String;", "")]
public static string ToString (int i, int radix);
[<Android.Runtime.Register("toString", "(II)Ljava/lang/String;", "")>]
static member ToString : int * int -> string

Parameters

i
Int32

an integer to be converted to a string.

radix
Int32

the radix to use in the string representation.

Returns

a string representation of the argument in the specified radix.

Attributes

Remarks

Returns a string representation of the first argument in the radix specified by the second argument.

If the radix is smaller than Character.MIN_RADIX or larger than Character.MAX_RADIX, then the radix 10 is used instead.

If the first argument is negative, the first element of the result is the ASCII minus character '-' ('\u005Cu002D'). If the first argument is not negative, no sign character appears in the result.

The remaining characters of the result represent the magnitude of the first argument. If the magnitude is zero, it is represented by a single zero character '0' ('\u005Cu0030'); otherwise, the first character of the representation of the magnitude will not be the zero character. The following ASCII characters are used as digits:

<blockquote> 0123456789abcdefghijklmnopqrstuvwxyz</blockquote>

These are '\u005Cu0030' through '\u005Cu0039' and '\u005Cu0061' through '\u005Cu007A'. If radix is <var>N</var>, then the first <var>N</var> of these characters are used as radix-<var>N</var> digits in the order shown. Thus, the digits for hexadecimal (radix 16) are 0123456789abcdef. If uppercase letters are desired, the java.lang.String#toUpperCase() method may be called on the result:

<blockquote> Integer.toString(n, 16).toUpperCase()</blockquote>

Java documentation for java.lang.Integer.toString(int, 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.

Applies to

ToString(Int32)

Returns a String object representing the specified integer.

[Android.Runtime.Register("toString", "(I)Ljava/lang/String;", "")]
public static string ToString (int i);
[<Android.Runtime.Register("toString", "(I)Ljava/lang/String;", "")>]
static member ToString : int -> string

Parameters

i
Int32

an integer to be converted.

Returns

a string representation of the argument in base&nbsp;10.

Attributes

Remarks

Returns a String object representing the specified integer. The argument is converted to signed decimal representation and returned as a string, exactly as if the argument and radix 10 were given as arguments to the #toString(int, int) method.

Java documentation for java.lang.Integer.toString(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.

Applies to