Function ascii_converter::decimals_to_string[][src]

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

This function takes in Decimal numbers and will return the string they represent

this function will takes a Vec<u8> and changes each element to a char then pushs it into a string. if a element of the vec passed in is below 32 or above 126 it will cause an error to be thrown.

Example

use ascii_converter::*;
 
let hello_world = vec![72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33];
    
assert_eq!(decimals_to_string(&hello_world).unwrap(), "Hello world!".to_string());