Closed dpalay closed 7 years ago
@dpalay how should it work?
Hi,
BigInteger.js already supports conversion to and from bases higher than 36, as well as negative bases. Can you clarify exactly what you're requesting?
Hi Peter,
Absolutely! Sorry, I blanked on the fact that it CAN already do this, but what I had meant was to be able to define an alphabet, instead of having the
Currently, the alphabet is 0-9a-z and then above that is
This sounds like something that would be easier to (and specific enough to) incorporate personally into your code. Take the example from the README.md
for example:
bigInt(567890).toString(100) => "<56><78><90>"
A very simple string parser and switch statement in an iterative loop could easily digest this string and spit out what you would like each numbers -- <56>
, <78>
, and <90>
-- to stand for instead. Defining a library would take nearly as much time, as you would still have to define each number case and the letter/number you want to represent it as.
As benjaminBrownlee said, I think this is a specific enough functionality that it would make more sense to handle in user code rather than baking it into the library.
I haven't yet found another library that lets me convert very large numbers into bases higher than 36. It would be very helpful for compressing large numbers down.