Class Bcd
Class for encoding and decoding bytes into BCD (binary coded decimal) format.
public class Bcd : Base16, ITextEncoding
- Inheritance
-
objectBcd
- Implements
- Inherited Members
Remarks
BCD is a way to represent decimal data in a format that is both easy to parse and easily human-readable. Each four bits is one decimal digit. The obvious disadvantage is that the data is far less dense. Each byte can only contain less than seven full bits of data.
Properties
CharacterSet
The set of characters that correspond to numbers 0 - 16.
protected override Span<char> CharacterSet { get; }
Property Value
- Span<char>
Methods
DecodeText(ReadOnlySpan<char>, Span<byte>)
public static void DecodeText(ReadOnlySpan<char> encoded, Span<byte> data)
Parameters
encoded
ReadOnlySpan<char>data
Span<byte>
DecodeText(string)
public static byte[] DecodeText(string encoded)
Parameters
encoded
string
Returns
- byte[]
EncodeBytes(ReadOnlySpan<byte>)
public static string EncodeBytes(ReadOnlySpan<byte> data)
Parameters
data
ReadOnlySpan<byte>
Returns
- string
EncodeBytes(ReadOnlySpan<byte>, Span<char>)
public static void EncodeBytes(ReadOnlySpan<byte> data, Span<char> encoded)
Parameters
data
ReadOnlySpan<byte>encoded
Span<char>