The from_str_radix
method perform string to integer convertion for a specific radix, but how to do the opposite, convert a integer into a string with a specific radix ?
For the pre-defined bases of 2, 8, 10, and 16, use the built-in formatting traits: Binary
, Octal
, Display
, LowerHex
and UpperHex
. For any other base, it's still trivial to roll your own by repeated division and remainder taking.
2 Likes
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.