HexFormat
Represents hexadecimal format options for formatting and parsing byte arrays and integer numeric values, both signed and unsigned.
An instance of this class is passed to formatting and parsing functions and specifies how formatting and parsing should be conducted. The options of the bytes property apply only when formatting and parsing byte arrays, while the number property applies when formatting and parsing numeric values. The upperCase option affects both.
This class is immutable and cannot be created or configured directly. To create a new format, use the HexFormat { }
builder function and configure the options inside the braces. For example, use val format = HexFormat { upperCase = true }
to enable upper-case formatting.
Two predefined instances are provided by this class's companion object: Default and UpperCase. The Default instance has the upperCase option set to false
, and the options of bytes and number properties set to their default values as specified in BytesHexFormat and NumberHexFormat, respectively. The UpperCase instance has the upperCase option set to true
, and the options of bytes and number properties set to their default values.
Since Kotlin
1.9See also
Samples
Types
Represents hexadecimal format options for formatting and parsing byte arrays.
Represents hexadecimal format options for formatting and parsing numeric values.