Creates a string representing the given value in base 10, or some other specified base.
SDK
- Xcode 10.0+
Framework
- Swift Standard Library
Declaration
Parameters
value
The value to convert to a string.
radix
The base to use for the string representation.
radix
must be at least 2 and at most 36. The default is 10.uppercase
Pass
true
to use uppercase letters to represent numerals greater than 9, orfalse
to use lowercase letters. The default isfalse
.
Discussion
The following example converts the maximal Int
value to a string and prints its length:
Numerals greater than 9 are represented as Roman letters. These letters start with "A"
if uppercase
is true
; otherwise, with "a"
.