Interfaces
interface Formattable
public interface Formattable {
func format(fmt: String): String
}
Description: Defines the formatting function, that is, converting an instance of a specified type to a string in the corresponding format according to the formatting parameter.
For details about the formatting parameter, see Overview in the convert package.
For other types, this interface can be implemented to provide the formatting function.
func format(String)
func format(fmt: String): String
Description: Formats the current instance into a string in the corresponding format according to the formatting parameter.
Parameters:
- fmt: String: formatting parameter
Returns:
- String: string obtained after the current instance is formatted
extend Float16 <: Formattable
extend Float16 <: Formattable
Description: Extends the Formattable interface for Float16 to convert a Float16 instance to a formatted string.
Parent types:
func format(String)
public func format(fmt: String): String
Description: Formats the current Float16 instance into a string in the corresponding format according to the formatting parameter.
Parameters:
- fmt: String: formatting parameter
Returns:
Throws:
- IllegalArgumentException: If fmt is invalid, this exception is thrown.
extend Float32 <: Formattable
extend Float32 <: Formattable
Description: Extends the Formattable interface for Float32 to convert a Float32 instance to a formatted string.
Parent types:
func format(String)
public func format(fmt: String): String
Description: Formats the current Float32 instance into a string in the corresponding format according to the formatting parameter.
Parameters:
- fmt: String: formatting parameter
Returns:
Throws:
- IllegalArgumentException: If fmt is invalid, this exception is thrown.
extend Float64 <: Formattable
extend Float64 <: Formattable
Description: Extends the Formattable interface for Float64 to convert a Float64 instance to a formatted string.
Parent types:
func format(String)
public func format(fmt: String): String
Description: Formats the current Float64 instance into a string in the corresponding format according to the formatting parameter.
Parameters:
- fmt: String: formatting parameter
Returns:
Throws:
- IllegalArgumentException: If fmt is invalid, this exception is thrown.
extend Int16 <: Formattable
extend Int16 <: Formattable
Description: Extends the Formattable interface for Int16 to convert an Int16 instance to a formatted string.
Parent types:
func format(String)
public func format(fmt: String): String
Description: Formats the current Int16 instance into a string in the corresponding format according to the formatting parameter.
Parameters:
- fmt: String: formatting parameter
Returns:
Throws:
- IllegalArgumentException: If fmt is invalid, this exception is thrown.
extend Int32 <: Formattable
extend Int32 <: Formattable
Description: Extends the Formattable interface for Int32 to convert an Int32 instance to a formatted string.
Parent types:
func format(String)
public func format(fmt: String): String
Description: Formats the current Int32 instance into a string in the corresponding format according to the formatting parameter.
Parameters:
- fmt: String: formatting parameter
Returns:
Throws:
- IllegalArgumentException: If fmt is invalid, this exception is thrown.
extend Int64 <: Formattable
extend Int64 <: Formattable
Description: Extends the Formattable interface for Int64 to convert an Int64 instance to a formatted string.
Parent types:
func format(String)
public func format(fmt: String): String
Description: Formats the current Int64 instance into a string in the corresponding format according to the formatting parameter.
Parameters:
- fmt: String: formatting parameter
Returns:
Throws:
- IllegalArgumentException: If fmt is invalid, this exception is thrown.
extend Int8 <: Formattable
extend Int8 <: Formattable
Description: Extends the Formattable interface for Int8 to convert an Int8 instance to a formatted string.
Parent types:
func format(String)
public func format(fmt: String): String
Description: Formats the current Int8 instance into a string in the corresponding format according to the formatting parameter.
Parameters:
- fmt: String: formatting parameter
Returns:
Throws:
- IllegalArgumentException: If fmt is invalid, this exception is thrown.
extend Rune <: Formattable
extend Rune <: Formattable
Description: Extends the Formattable interface for Rune to convert a Rune instance to a formatted string.
Parent types:
func format(String)
public func format(fmt: String): String
Description: Formats the current Rune instance into a string in the corresponding format according to the formatting parameter.
Parameters:
- fmt: String: formatting parameter
Returns:
Throws:
- IllegalArgumentException: If fmt is invalid, this exception is thrown.
extend UInt16 <: Formattable
extend UInt16 <: Formattable
Description: Extends the Formattable interface for UInt16 to convert a UInt16 instance to a formatted string.
Parent types:
func format(String)
public func format(fmt: String): String
Description: Formats the current UInt16 instance into a string in the corresponding format according to the formatting parameter.
Parameters:
- fmt: String: formatting parameter
Returns:
Throws:
- IllegalArgumentException: If fmt is invalid, this exception is thrown.
extend UInt32 <: Formattable
extend UInt32 <: Formattable
Description: Extends the Formattable interface for UInt32 to convert a UInt32 instance to a formatted string.
Parent types:
func format(String)
public func format(fmt: String): String
Description: Formats the current UInt32 instance into a string in the corresponding format according to the formatting parameter.
Parameters:
- fmt: String: formatting parameter
Returns:
Throws:
- IllegalArgumentException: If fmt is invalid, this exception is thrown.
extend UInt64 <: Formattable
extend UInt64 <: Formattable
Description: Extends the Formattable interface for UInt64 to convert a UInt64 instance to a formatted string.
Parent types:
func format(String)
public func format(fmt: String): String
Description: Formats the current UInt64 instance into a string in the corresponding format according to the formatting parameter.
Parameters:
- fmt: String: formatting parameter
Returns:
Throws:
- IllegalArgumentException: If fmt is invalid, this exception is thrown.
extend UInt8 <: Formattable
extend UInt8 <: Formattable
Description: Extends the Formattable interface for UInt8 to convert a UInt8 instance to a formatted string.
Parent types:
func format(String)
public func format(fmt: String): String
Description: Formats the current UInt8 instance into a string in the corresponding format according to the formatting parameter.
Parameters:
- fmt: String: formatting parameter
Returns:
Throws:
- IllegalArgumentException: If fmt is invalid, this exception is thrown.
interface Parsable<T>
public interface Parsable<T> {
static func parse(value: String): T
static func tryParse(value: String): Option<T>
}
Description: Provides unified methods to parse strings to specific types.
This interface provides two methods: parse and tryParse. The parse method throws an exception when parsing fails. The tryParse method returns the result encapsulated with Option. If parsing fails, the tryParse method returns None. In this package, the basic types, such as Bool, Rune, Float16, and Int64, have implemented this interface. This interface can be used to convert strings to these types.
static func parse(String)
static func parse(value: String): T
Description: Parses a string into a specific type.
Parameters:
- value: String: string to be parsed
Returns:
- T: value after conversion
static func tryParse(String)
static func tryParse(value: String): Option<T>
Description: Parses a string into a specific type.
Parameters:
- value: String: string to be parsed
Returns:
extend Bool <: Parsable<Bool>
extend Bool <: Parsable<Bool>
Description: Implements related operation functions of converting a Bool literal string to a Bool value.
Parent types:
static func parse(String)
public static func parse(data: String): Bool
Description: Converts a Bool literal string to a Bool value.
Parameters:
- data: String: string to be converted
Returns:
Throws:
- IllegalArgumentException: If the string is empty or conversion fails, this exception is thrown.
static func tryParse(String)
public static func tryParse(data: String): Option<Bool>
Description: Converts a Bool literal string to an Option<Bool> value.
Parameters:
- data: String: string to be converted
Returns:
- Option<Bool>: Option<Bool> value after conversion. If the conversion fails, Option<Bool>.None is returned.
extend Float16 <: Parsable<Float16>
extend Float16 <: Parsable<Float16>
Description: Implements related operation functions of converting a Float16 literal string to a Float16 value.
Parent types:
static func parse(String)
public static func parse(data: String): Float16
Description: Converts a Float16 literal string to a Float16 value.
Parameters:
- data: String: string to be converted
Returns:
Throws:
- IllegalArgumentException: If the string does not comply with the floating-point number syntax, this exception is thrown.
static func tryParse(String)
public static func tryParse(data: String): Option<Float16>
Description: Converts a Float16 literal string to an Option<Float16> value.
Parameters:
- data: String: string to be converted
Returns:
- Option<Float16>: Option<Float16> value after conversion. If the conversion fails, Option<Float16>.None is returned.
extend Float32 <: Parsable<Float32>
extend Float32 <: Parsable<Float32>
Description: Implements related operation functions of converting a Float32 literal string to a Float32 value.
Parent types:
static func parse(String)
public static func parse(data: String): Float32
Description: Converts a Float32 literal string to a Float32 value.
Parameters:
- data: String: string to be converted
Returns:
Throws:
- IllegalArgumentException: If the string does not comply with the floating-point number syntax, this exception is thrown.
static func tryParse(String)
public static func tryParse(data: String): Option<Float32>
Description: Converts a Float32 literal string to an Option<Float32> value.
Parameters:
- data: String: string to be converted
Returns:
- Option<Float32>: Option<Float32> value after conversion. If the conversion fails, Option<Float32>.None is returned.
extend Float64 <: Parsable<Float64>
extend Float64 <: Parsable<Float64>
Description: Implements related operation functions of converting a Float64 literal string to a Float64 value.
Parent types:
static func parse(String)
public static func parse(data: String): Float64
Description: Converts a Float64 literal string to a Float64 value.
Parameters:
- data: String: string to be converted
Returns:
Throws:
- IllegalArgumentException: If the string does not comply with the floating-point number syntax, this exception is thrown.
static func tryParse(String)
public static func tryParse(data: String): Option<Float64>
Description: Converts a Float64 literal string to an Option<Float64> value.
Parameters:
- data: String: string to be converted
Returns:
- Option<Float64>: Option<Float64> value after conversion. If the conversion fails, Option<Float64>.None is returned.
extend Int16 <: Parsable<Int16>
extend Int16 <: Parsable<Int16>
Description: Implements related operation functions of converting an Int16 literal string to an Int16 value.
Parent types:
static func parse(String)
public static func parse(data: String): Int16
Description: Converts an Int16 literal string to an Int16 value.
Parameters:
- data: String: string to be converted
Returns:
Throws:
- IllegalArgumentException: If the string is empty, the first character of the string is
+, the conversion fails, the value after conversion exceeds the range of Int16, or the string contains an invalid UTF-8 character, this exception is thrown.
static func tryParse(String)
public static func tryParse(data: String): Option<Int16>
Description: Converts an Int16 literal string to an Option<Int16> value.
Parameters:
- data: String: string to be converted
Returns:
- Option<Int16>: Option<Int16> value after conversion. If the conversion fails, Option<Int16>.None is returned.
extend Int32 <: Parsable<Int32>
extend Int32 <: Parsable<Int32>
Description: Implements related operation functions of converting an Int32 literal string to an Int32 value.
Parent types:
static func parse(String)
public static func parse(data: String): Int32
Description: Converts an Int32 literal string to an Int32 value.
Parameters:
- data: String: string to be converted
Returns:
Throws:
- IllegalArgumentException: If the string is empty, the first character of the string is
+, the conversion fails, the value after conversion exceeds the range of Int32, or the string contains an invalid UTF-8 character, this exception is thrown.
static func tryParse(String)
public static func tryParse(data: String): Option<Int32>
Description: Converts an Int32 literal string to an Option<Int32> value.
Parameters:
- data: String: string to be converted
Returns:
- Option<Int32>: Option<Int32> value after conversion. If the conversion fails, Option<Int32>.None is returned.
extend Int64 <: Parsable<Int64>
extend Int64 <: Parsable<Int64>
Description: Implements related operation functions of converting an Int64 literal string to an Int64 value.
Parent types:
static func parse(String)
public static func parse(data: String): Int64
Description: Converts an Int64 literal string to an Int64 value.
Parameters:
- data: String: string to be converted
Returns:
Throws:
- IllegalArgumentException: If the string is empty, the first character of the string is
+, the conversion fails, the value after conversion exceeds the range of Int64, or the string contains an invalid UTF-8 character, this exception is thrown.
static func tryParse(String)
public static func tryParse(data: String): Option<Int64>
Description: Converts an Int64 literal string to an Option<Int64> value.
Parameters:
- data: String: string to be converted
Returns:
- Option<Int64>: Option<Int64> value after conversion. If the conversion fails, Option<Int64>.None is returned.
extend Int8 <: Parsable<Int8>
extend Int8 <: Parsable<Int8>
Description: Implements related operation functions of converting an Int8 literal string to an Int8 value.
Parent types:
static func parse(String)
public static func parse(data: String): Int8
Description: Converts an Int8 literal string to an Int8 value.
Parameters:
- data: String: string to be converted
Returns:
Throws:
- IllegalArgumentException: If the string is empty, the first character of the string is
+, the conversion fails, the value after conversion exceeds the range of Int8, or the string contains an invalid UTF-8 character, this exception is thrown.
static func tryParse(String)
public static func tryParse(data: String): Option<Int8>
Description: Converts an Int8 literal string to an Option<Int8> value.
Parameters:
- data: String: string to be converted
Returns:
- Option<Int8>: Option<Int8> value after conversion. If the conversion fails, Option<Int8>.None is returned.
extend Rune <: Parsable<Rune>
extend Rune <: Parsable<Rune>
Description: Implements related operation functions of converting a Rune literal string to a Rune value.
Parent types:
static func parse(String)
public static func parse(data: String): Rune
Description: Converts a Rune literal string to a Rune value.
Parameters:
- data: String: string to be converted
Returns:
Throws:
- IllegalArgumentException: If the string is empty, the conversion fails, or the string contains an invalid UTF-8 character, this exception is thrown.
static func tryParse(String)
public static func tryParse(data: String): Option<Rune>
Description: Converts a Rune literal string to an Option<Rune> value.
Parameters:
- data: String: string to be converted
Returns:
- Option<Rune>: Option<Rune> value after conversion. If the conversion fails, Option<Rune>.None is returned.
extend UInt16 <: Parsable<UInt16>
extend UInt16 <: Parsable<UInt16>
Description: Implements related operation functions of converting a UInt16 literal string to a UInt16 value.
Parent types:
static func parse(String)
public static func parse(data: String): UInt16
Description: Converts a UInt16 literal string to a UInt16 value.
Parameters:
- data: String: string to be converted
Returns:
Throws:
- IllegalArgumentException: If the string is empty, the first character of the string is
+or-, the conversion fails, the value after conversion exceeds the range of UInt16, or the string contains an invalid UTF-8 character, this exception is thrown.
static func tryParse(String)
public static func tryParse(data: String): Option<UInt16>
Description: Converts a UInt16 literal string to an Option<UInt16> value.
Parameters:
- data: String: string to be converted
Returns:
- Option<UInt16>: Option<UInt16> value after conversion. If the conversion fails, Option<UInt16>.None is returned.
extend UInt32 <: Parsable<UInt32>
extend UInt32 <: Parsable<UInt32>
Description: Implements related operation functions of converting a UInt32 literal string to a UInt32 value.
Parent types:
static func parse(String)
public static func parse(data: String): UInt32
Description: Converts a UInt32 literal string to a UInt32 value.
Parameters:
- data: String: string to be converted
Returns:
Throws:
- IllegalArgumentException: If the string is empty, the first character of the string is
+or-, the conversion fails, the value after conversion exceeds the range of UInt32, or the string contains an invalid UTF-8 character, this exception is thrown.
static func tryParse(String)
public static func tryParse(data: String): Option<UInt32>
Description: Converts a UInt32 literal string to an Option<UInt32> value.
Parameters:
- data: String: string to be converted
Returns:
- Option<UInt32>: Option<UInt32> value after conversion. If the conversion fails, Option<UInt32>.None is returned.
extend UInt64 <: Parsable<UInt64>
extend UInt64 <: Parsable<UInt64>
Description: Implements related operation functions of converting a UInt64 literal string to a UInt64 value.
Parent types:
static func parse(String)
public static func parse(data: String): UInt64
Description: Converts a UInt64 literal string to a UInt64 value.
Parameters:
- data: String: string to be converted
Returns:
Throws:
- IllegalArgumentException: If the string is empty, the first character of the string is
+or-, the conversion fails, the value after conversion exceeds the range of UInt64, or the string contains an invalid UTF-8 character, this exception is thrown.
static func tryParse(String)
public static func tryParse(data: String): Option<UInt64>
Description: Converts a UInt64 literal string to an Option<UInt64> value.
Parameters:
- data: String: string to be converted
Returns:
- Option<UInt64>: Option<UInt64> value after conversion. If the conversion fails, Option<UInt64>.None is returned.
extend UInt8 <: Parsable<UInt8>
extend UInt8 <: Parsable<UInt8>
Description: Implements related operation functions of converting a UInt8 literal string to a UInt8 value.
Parent types:
static func parse(String)
public static func parse(data: String): UInt8
Description: Converts a UInt8 literal string to a UInt8 value.
Parameters:
- data: String: string to be converted
Returns:
Throws:
- IllegalArgumentException: If the string is empty, the first character of the string is
+or-, the conversion fails, the value after conversion exceeds the range of UInt8, or the string contains an invalid UTF-8 character, this exception is thrown.
static func tryParse(String)
public static func tryParse(data: String): Option<UInt8>
Description: Converts a UInt8 literal string to an Option<UInt8> value.
Parameters:
- data: String: string to be converted
Returns:
- Option<UInt8>: Option<UInt8> value after conversion. If the conversion fails, Option<UInt8>.None is returned.
interface RadixConvertible<T>
public interface RadixConvertible<T> {
static func parse(value: String, radix!: Int): T
static func tryParse(value: String, radix!: Int): Option<T>
func toString(radix!: Int): String
}
Description: Provides unified methods to parse strings in specified numeral systems into specific types.
Numeral systems are specified by parameters instead of string prefixes. The numbers represented with numeral systems must fall in a range from binary numbers to base-36 numbers. Otherwise, an exception is thrown. Representations exceeding the decimal system follow alphabetical order in uppercase or lowercase letters, that is, 10 digits + 26 letters = base-36 system. An Int-type string can start with + or -, which can be processed to start with + if not starting with + or -. A UInt-type string can start with +, with an exception thrown if starting with -. Strings in specified numeral systems are returned. Representations exceeding the decimal system follow alphabetical order in lowercase letters, that is, 10 digits + 26 lowercase letters = base-36 system.
This interface provides two methods: parse and tryParse. The parse method throws an exception when parsing fails. The tryParse method returns the result encapsulated with Option. If parsing fails, the tryParse method returns None. In this package, this interface has been implemented for basic types such as Int64 and UInt64, and can be used to convert strings to these types.
static func parse(String, Int)
static func parse(value: String, radix!: Int): T
Description: Parses a string in a specified numeral system into a specific type.
Parameters:
Returns:
- T: value after conversion
static func tryParse(String, Int)
static func tryParse(value: String, radix!: Int): Option<T>
Description: Parses a string in a specified numeral system into a specific type.
Parameters:
Returns:
func toString(Int)
func toString(radix!: Int): String
Description: Returns a string in a specified numeral system.
Parameters:
- radix!: Int: specified numeral system
Returns:
- String: string in the specified numeral system
extend Int8 <: RadixConvertible<Int8>
extend Int8 <: RadixConvertible<Int8>
Description: Implements related operation functions of converting an Int8 literal string to an Int8 value.
Parent types:
static func parse(String, Int)
public static func parse(value: String, radix!: Int): Int8
Description: Converts an Int8 literal string to an Int8 value.
Parameters:
Returns:
Throws:
- IllegalArgumentException: If the string is empty, the numeral system exceeds the range, the value after conversion exceeds the range of Int8, the string contains an invalid UTF-8 character, or the conversion fails, this exception is thrown.
static func tryParse(String, Int)
public static func tryParse(value: String, radix!: Int): Option<Int8>
Description: Converts an Int8 literal string to an Option<Int8> value.
Parameters:
Returns:
- Option<Int8>: Option<Int8> value after conversion. If the conversion fails, Option<Int8>.None is returned.
func toString(Int)
public func toString(radix!: Int): String
Description: Returns a string in a specified numeral system.
Parameters:
- radix!: Int: specified numeral system
Returns:
- String: string in the specified numeral system
Throws:
- IllegalArgumentException: If the numeral system is invalid, this exception is thrown.
extend Int16 <: RadixConvertible<Int16>
extend Int16 <: RadixConvertible<Int16>
Description: Implements related operation functions of converting an Int16 literal string to an Int16 value.
Parent types:
static func parse(String, Int)
public static func parse(value: String, radix!: Int): Int16
Description: Converts an Int16 literal string to an Int16 value.
Parameters:
Returns:
Throws:
- IllegalArgumentException: If the string is empty, the numeral system exceeds the range, the value after conversion exceeds the range of Int16, the string contains an invalid UTF-8 character, or the conversion fails, this exception is thrown.
static func tryParse(String, Int)
public static func tryParse(value: String, radix!: Int): Option<Int16>
Description: Converts an Int16 literal string to an Option<Int16> value.
Parameters:
Returns:
- Option<Int16>: Option<Int16> value after conversion. If the conversion fails, Option<Int16>.None is returned.
func toString(Int)
public func toString(radix!: Int): String
Description: Returns a string in a specified numeral system.
Parameters:
- radix!: Int: specified numeral system
Returns:
- String: string in the specified numeral system
Throws:
- IllegalArgumentException: If the numeral system is invalid, this exception is thrown.
extend Int32 <: RadixConvertible<Int32>
extend Int32 <: RadixConvertible<Int32>
Description: Implements related operation functions of converting an Int32 literal string to an Int32 value.
Parent types:
static func parse(String, Int)
public static func parse(value: String, radix!: Int): Int32
Description: Converts an Int32 literal string to an Int32 value.
Parameters:
Returns:
Throws:
- IllegalArgumentException: If the string is empty, the numeral system exceeds the range, the value after conversion exceeds the range of Int32, the string contains an invalid UTF-8 character, or the conversion fails, this exception is thrown.
static func tryParse(String, Int)
public static func tryParse(value: String, radix!: Int): Option<Int32>
Description: Converts an Int32 literal string to an Option<Int32> value.
Parameters:
Returns:
- Option<Int32>: Option<Int32> value after conversion. If the conversion fails, Option<Int32>.None is returned.
func toString(Int)
public func toString(radix!: Int): String
Description: Returns a string in a specified numeral system.
Parameters:
- radix!: Int: specified numeral system
Returns:
- String: string in the specified numeral system
Throws:
- IllegalArgumentException: If the numeral system is invalid, this exception is thrown.
extend Int64 <: RadixConvertible<Int64>
extend Int64 <: RadixConvertible<Int64>
Description: Implements related operation functions of converting an Int64 literal string to an Int64 value.
Parent types:
static func parse(String, Int)
public static func parse(value: String, radix!: Int): Int64
Description: Converts an Int64 literal string to an Int64 value.
Parameters:
Returns:
Throws:
- IllegalArgumentException: If the string is empty, the numeral system exceeds the range, the value after conversion exceeds the range of Int64, the string contains an invalid UTF-8 character, or the conversion fails, this exception is thrown.
static func tryParse(String, Int)
public static func tryParse(value: String, radix!: Int): Option<Int64>
Description: Converts an Int64 literal string to an Option<Int64> value.
Parameters:
Returns:
- Option<Int64>: Option<Int64> value after conversion. If the conversion fails, Option<Int64>.None is returned.
func toString(Int)
public func toString(radix!: Int): String
Description: Returns a string in a specified numeral system.
Parameters:
- radix!: Int: specified numeral system
Returns:
- String: string in the specified numeral system
Throws:
- IllegalArgumentException: If the numeral system is invalid, this exception is thrown.
extend UInt8 <: RadixConvertible<UInt8>
extend UInt8 <: RadixConvertible<UInt8>
Description: Implements related operation functions of converting a UInt8 literal string to a UInt8 value.
Parent types:
static func parse(String, Int)
public static func parse(value: String, radix!: Int): UInt8
Description: Converts a UInt8 literal string to a UInt8 value.
Parameters:
Returns:
Throws:
- IllegalArgumentException: If the string is empty, the numeral system exceeds the range, the string starts with
-, the value after conversion exceeds the range of UInt8, or the string contains an invalid UTF-8 character, this exception is thrown.
static func tryParse(String, Int)
public static func tryParse(value: String, radix!: Int): Option<UInt8>
Description: Converts a UInt8 literal string to an Option<UInt8> value.
Parameters:
Returns:
- Option<UInt8>: Option<UInt8> value after conversion. If the conversion fails, Option<UInt8>.None is returned.
func toString(Int)
public func toString(radix!: Int): String
Description: Returns a string in a specified numeral system.
Parameters:
- radix!: Int: specified numeral system
Returns:
- String: string in the specified numeral system
Throws:
- IllegalArgumentException: If the numeral system is invalid, this exception is thrown.
extend UInt16 <: RadixConvertible<UInt16>
extend UInt16 <: RadixConvertible<UInt16>
Description: Implements related operation functions of converting a UInt16 literal string to a UInt16 value.
Parent types:
static func parse(String, Int)
public static func parse(value: String, radix!: Int): UInt16
Description: Converts a UInt16 literal string to a UInt16 value.
Parameters:
Returns:
Throws:
- IllegalArgumentException: If the string is empty, the numeral system exceeds the range, the string starts with
-, the value after conversion exceeds the range of UInt16, or the string contains an invalid UTF-8 character, this exception is thrown.
static func tryParse(String, Int)
public static func tryParse(value: String, radix!: Int): Option<UInt16>
Description: Converts a UInt16 literal string to an Option<UInt16> value.
Parameters:
Returns:
- Option<UInt16>: Option<UInt16> value after conversion. If the conversion fails, Option<UInt16>.None is returned.
func toString(Int)
public func toString(radix!: Int): String
Description: Returns a string in a specified numeral system.
Parameters:
- radix!: Int: specified numeral system
Returns:
- String: string in the specified numeral system
Throws:
- IllegalArgumentException: If the numeral system is invalid, this exception is thrown.
extend UInt32 <: RadixConvertible<UInt32>
extend UInt32 <: RadixConvertible<UInt32>
Description: Implements related operation functions of converting a UInt32 literal string to a UInt32 value.
Parent types:
static func parse(String, Int)
public static func parse(value: String, radix!: Int): UInt32
Description: Converts a UInt32 literal string to a UInt32 value.
Parameters:
Returns:
Throws:
- IllegalArgumentException: If the string is empty, the numeral system exceeds the range, the string starts with
-, the value after conversion exceeds the range of UInt32, or the string contains an invalid UTF-8 character, this exception is thrown.
static func tryParse(String, Int)
public static func tryParse(value: String, radix!: Int): Option<UInt32>
Description: Converts a UInt32 literal string to an Option<UInt32> value.
Parameters:
Returns:
- Option<UInt32>: Option<UInt32> value after conversion. If the conversion fails, Option<UInt32>.None is returned.
func toString(Int)
public func toString(radix!: Int): String
Description: Returns a string in a specified numeral system.
Parameters:
- radix!: Int: specified numeral system
Returns:
- String: string in the specified numeral system
Throws:
- IllegalArgumentException: If the numeral system is invalid, this exception is thrown.
extend UInt64 <: RadixConvertible<UInt64>
extend UInt64 <: RadixConvertible<UInt64>
Description: Implements related operation functions of converting a UInt64 literal string to a UInt64 value.
Parent types:
static func parse(String, Int)
public static func parse(value: String, radix!: Int): UInt64
Description: Converts a UInt64 literal string to a UInt64 value.
Parameters:
Returns:
Throws:
- IllegalArgumentException: If the string is empty, the numeral system exceeds the range, the string starts with
-, the value after conversion exceeds the range of UInt64, or the string contains an invalid UTF-8 character, this exception is thrown.
static func tryParse(String, Int)
public static func tryParse(value: String, radix!: Int): Option<UInt64>
Description: Converts a UInt64 literal string to an Option<UInt64> value.
Parameters:
Returns:
- Option<UInt64>: Option<UInt64> value after conversion. If the conversion fails, Option<UInt64>.None is returned.
func toString(Int)
public func toString(radix!: Int): String
Description: Returns a string in a specified numeral system.
Parameters:
- radix!: Int: specified numeral system
Returns:
- String: string in the specified numeral system
Throws:
- IllegalArgumentException: If the numeral system is invalid, this exception is thrown.