Skip to content
Helpers

BaseX_2_10

Internal helper function
static unsigned long long int BaseX_2_10(const std::string num, const std::string set)

A static helper function.

Will convert number num back to base 10 given its original charset.

Prone to overflows if used improperly!

Be careful, this function IS prone to integer overflows!
Don't put in values larger than unsigned long long int!


Examples:

Convert hex to decimal:
int myDecimal = Helpers::BaseX_2_10("1a4", "0123456789abcdef");
Convert binary to decimal:
int myDecimal = Helpers::BaseX_2_10("1000101", "01");