Skip to main content

encode_bcd

Function encode_bcd 

Source
pub fn encode_bcd(s: &str) -> Result<Vec<u8>>
Available on crate feature std only.
Expand description

Encode numeric string to BCD

Each pair of digits is encoded into one byte. If the string has odd length, a leading zero is added.

Example: “1234” -> [0x12, 0x34] Example: “123” -> [0x01, 0x23]