Skip to content
Helpers

Base10_2_X

Internal helper function
static std::string Base10_2_X(const unsigned long long int i, const std::string set, unsigned int padding = 0);

A static helper function.

Will convert number i to any base given a charset.

You can specify a padding value. This is the output of 0-10 (in binary) with a padding value of 4:

0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010

Examples:

Convert decimal to hex:
std::string myHex    = Helpers::Base10_2_X(12648430, "0123456789abcdef");
Convert decimal to binary:
std::string myBinary = Helpers::Base10_2_X(69, "01");