pub fn decimals_to_binary(dec_vec: &Vec<u8>) -> Result<Vec<u32>, String>
Expand description

This function returns a binary representations of decimal numbers

this function takes a Vec<u8> , it’s elements should represent ascii characters. An error will be thrown if the a value is above 126 as this is the end of the ascii range.

Example

use ascii_converter::*;
 
let  hello_world = vec![72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33];
let expected = vec![1001000, 1100101, 1101100, 1101100, 1101111, 100000, 1110111, 1101111, 1110010, 1101100, 1100100, 100001];
    
assert_eq!(decimals_to_binary(&hello_world).unwrap(), expected);