Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HexFormat API #362

Open
qurbonzoda opened this issue Oct 11, 2023 · 2 comments
Open

HexFormat API #362

qurbonzoda opened this issue Oct 11, 2023 · 2 comments

Comments

@qurbonzoda
Copy link
Contributor

qurbonzoda commented Oct 11, 2023

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
Copy link
Contributor Author

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?

@qurbonzoda
Copy link
Contributor Author

In 2.0.20-Beta2, we have introduced NumberHexFormat.minLength option to address this use case.
The documentation for all HexFormat options were also improved, including for upperCase. This should help to avoid ambiguities and misunderstandings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant