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

Editorial: Generalize ToZeroPaddedDecimalString to support hexadecimal output #3305

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gibson042
Copy link
Contributor

No description provided.

Comment on lines +34862 to +34864
1. If _alphabet_ is ~hex-lower~, let _S_ be the String representation of _n_, formatted as a lowercase hexadecimal number.
1. Else if _alphabet_ is ~hex-upper~, let _S_ be the String representation of _n_, formatted as an uppercase hexadecimal number.
1. Else, let _S_ be the String representation of _n_, formatted as a decimal number.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also use the approach of proposal-regex-escaping and replace prose with AO calls, e.g.

Suggested change
1. If _alphabet_ is ~hex-lower~, let _S_ be the String representation of _n_, formatted as a lowercase hexadecimal number.
1. Else if _alphabet_ is ~hex-upper~, let _S_ be the String representation of _n_, formatted as an uppercase hexadecimal number.
1. Else, let _S_ be the String representation of _n_, formatted as a decimal number.
1. If _alphabet_ is ~decimal~, let _S_ be BigInt::toString(ℤ(_n_), 10).
1. Else if _alphabet_ is ~hex-lower~, let _S_ be BigInt::toString(ℤ(_n_), 16).
1. Else, let _S_ be the ASCII-uppercase of BigInt::toString(ℤ(_n_), 16).

(importing ECMA-402's ASCII-uppercase, as is already planned for Temporal)

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

Successfully merging this pull request may close these issues.

None yet

1 participant