https://github.com/neuodev/base-rs
Simple tool to convert from a given base into any other base. You can even create your own base
https://github.com/neuodev/base-rs
Last synced: 3 months ago
JSON representation
Simple tool to convert from a given base into any other base. You can even create your own base
- Host: GitHub
- URL: https://github.com/neuodev/base-rs
- Owner: neuodev
- Created: 2022-08-27T13:44:49.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-08-28T06:39:01.000Z (almost 4 years ago)
- Last Synced: 2025-03-02T07:02:43.372Z (over 1 year ago)
- Language: Rust
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bases
Simple tool to convert from a give **base** into any other **base**. **_You can even create your own base_**
1. From base 2 to/from base 10
2. From base 2 to/from base 16
3. From base 16 to base base 10
```bash
[base2] Base { base: 2, sys: ["0", "1"] }
[base10] Base { base: 10, sys: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] }
[base16] Base { base: 16, sys: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"] }
b2(10) -> 1010
b10(["1", "0", "1", "0"]) -> 10
b16(175) -> 0xAF
b10(["A", "F"]) -> 175
b16(["1", "0", "1", "0"]) -> 0xA
b2(["A"]) -> 1010
```