Skip to content

Convert from one base to another. Binary, octal, hexadecimal, decimal, etc.

License

Notifications You must be signed in to change notification settings

OASIS-systems/base_convert_cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BaseConvert

Note

This library is designed to work with the string representation of numbers. Basically you input a number as a string and get the output as a string. This was done for a specific use case

Convert from one base to another. Binary, octal, hexadecimal, decimal, etc
Supports base with 2-32 bits
Average performance is 200 nanoseconds per conversion (0.0002 milliseconds)
Check out usage_example.cpp for simplest implementation
Also, you can import files from lib directory to your project and use BaseConvert easily (check out lib_usage.cpp)

Examples

Convert from binary to decimal:

BaseConvert bc;
bc.convert("11111101000", 2, 10)

Convert from binary to hexadecimal:

BaseConvert bc;
bc.convert("11111101000", 2, 16)

Convert from hexadecimal to decimal:

BaseConvert bc;
std::cout << convertBase("7E8", 16, 10)

Suggestions

Feel free to suggest any changes 😊

Releases

No releases published

Packages

No packages published

Languages