2022-02-27 13:48:21 +01:00
|
|
|
#include "GeneralUtility.h"
|
2022-02-27 15:49:09 +01:00
|
|
|
#include <string>
|
2022-02-27 16:55:18 +01:00
|
|
|
|
2022-02-27 17:08:57 +01:00
|
|
|
std::string GeneralUtility::Base10_2_X(const std::uint64_t &num, const std::string &set, const std::uint32_t minOutLen) {
|
|
|
|
// Convert num to a string
|
|
|
|
std::stringstream ss;
|
|
|
|
ss << num;
|
|
|
|
const std::string numStr = ss.str();
|
|
|
|
|
|
|
|
// Use BaseX_2_Y to convert to outbase
|
2022-02-27 19:27:18 +01:00
|
|
|
const std::string convertedNum = BaseX_2_Y<std::string, std::string>(numStr, "0123456789", set, minOutLen);
|
2022-02-27 17:08:57 +01:00
|
|
|
|
|
|
|
// return it
|
|
|
|
return convertedNum;
|
|
|
|
}
|