toHexString

Formats bytes in this array using the specified format.

Note that only HexFormat.upperCase and HexFormat.BytesHexFormat affect formatting.

Since Kotlin

1.9

Parameters

format

the HexFormat to use for formatting, HexFormat.Default by default.

Throws

if the result length is more than String maximum capacity.


fun ByteArray.toHexString(startIndex: Int = 0, endIndex: Int = size, format: HexFormat = HexFormat.Default): String(source)
inline fun UByteArray.toHexString(startIndex: Int = 0, endIndex: Int = size, format: HexFormat = HexFormat.Default): String(source)

Formats bytes in this array using the specified HexFormat.

Note that only HexFormat.upperCase and HexFormat.BytesHexFormat affect formatting.

Since Kotlin

1.9

Parameters

startIndex

the beginning (inclusive) of the subrange to format, 0 by default.

endIndex

the end (exclusive) of the subrange to format, size of this array by default.

format

the HexFormat to use for formatting, HexFormat.Default by default.

Throws

when startIndex or endIndex is out of range of this array indices.

if the result length is more than String maximum capacity.


fun Byte.toHexString(format: HexFormat = HexFormat.Default): String(source)

Formats this Byte value using the specified format.

Note that only HexFormat.upperCase and HexFormat.NumberHexFormat affect formatting.

Since Kotlin

1.9

Parameters

format

the HexFormat to use for formatting, HexFormat.Default by default.


fun Short.toHexString(format: HexFormat = HexFormat.Default): String(source)

Formats this Short value using the specified format.

Note that only HexFormat.upperCase and HexFormat.NumberHexFormat affect formatting.

Since Kotlin

1.9

Parameters

format

the HexFormat to use for formatting, HexFormat.Default by default.


fun Int.toHexString(format: HexFormat = HexFormat.Default): String(source)

Formats this Int value using the specified format.

Note that only HexFormat.upperCase and HexFormat.NumberHexFormat affect formatting.

Since Kotlin

1.9

Parameters

format

the HexFormat to use for formatting, HexFormat.Default by default.


fun Long.toHexString(format: HexFormat = HexFormat.Default): String(source)

Formats this Long value using the specified format.

Note that only HexFormat.upperCase and HexFormat.NumberHexFormat affect formatting.

Since Kotlin

1.9

Parameters

format

the HexFormat to use for formatting, HexFormat.Default by default.


inline fun UByte.toHexString(format: HexFormat = HexFormat.Default): String(source)

Formats this UByte value using the specified format.

Note that only HexFormat.upperCase and HexFormat.NumberHexFormat affect formatting.

Since Kotlin

1.9

Parameters

format

the HexFormat to use for formatting, HexFormat.Default by default.


inline fun UShort.toHexString(format: HexFormat = HexFormat.Default): String(source)

Formats this UShort value using the specified format.

Note that only HexFormat.upperCase and HexFormat.NumberHexFormat affect formatting.

Since Kotlin

1.9

Parameters

format

the HexFormat to use for formatting, HexFormat.Default by default.


inline fun UInt.toHexString(format: HexFormat = HexFormat.Default): String(source)

Formats this UInt value using the specified format.

Note that only HexFormat.upperCase and HexFormat.NumberHexFormat affect formatting.

Since Kotlin

1.9

Parameters

format

the HexFormat to use for formatting, HexFormat.Default by default.


inline fun ULong.toHexString(format: HexFormat = HexFormat.Default): String(source)

Formats this ULong value using the specified format.

Note that only HexFormat.upperCase and HexFormat.NumberHexFormat affect formatting.

Since Kotlin

1.9

Parameters

format

the HexFormat to use for formatting, HexFormat.Default by default.