#numbers #binary #conversion #helper #is-10-binary-check

binary-helper

A simple binary conversion crate

5 releases

0.2.3 Oct 21, 2022
0.2.2 Oct 21, 2022
0.2.1 Oct 21, 2022
0.2.0 Oct 20, 2022
0.1.3 Oct 20, 2022

#2211 in Algorithms

MIT license

4KB
85 lines

Binary Helper

This crate serves 2 purposes:

1: converting a binary number to a base 10 number

2: converting a base 10 number to a binary number

Example

fn is_10_binary_check(x) -> String {
    let result = dec2binary(x,3);
    if result == "0001010"{
        "X is 10 (0001010 in binary)!".to_string()
    }
}

No runtime deps