Kotlin / KEEP

Kotlin Evolution and Enhancement Process
Apache License 2.0
3.29k stars 357 forks source link

HexFormat API #362

Open qurbonzoda opened 7 months ago

qurbonzoda commented 7 months ago

This issue is for discussion of the proposed API for formatting binary data into hexadecimal string form and parsing it back. The full text of the proposal is here. The API is already available in Kotlin 1.9.0+ as @ExperimentalStdlibApi.

qurbonzoda commented 7 months ago

The upperCase format option seems counterintuitive due to its name. The option determines whether to use upper case or lower case hexadecimal digits when formatting and is ignored when parsing. It doesn't affect prefix, suffix, or separator strings. To clarify things a bit some prefix could be used, e.g., isUpperCase, useUpperCase or useUpperCaseDigits. Another approach is to use "uppercase" as a verb, as in Char/String.uppercase(), e.g., uppercase or uppercaseDigits. WDYT?