Results for “Encoding & structured values”
Small, practical examples. Search by task or narrow things down below.
Decode a validated pair of hexadecimal digits
C: Convert each nibble and reject a nonhexadecimal character before combining them.
C✓ Tested
Decode JSON into a typed struct
Decode JSON into a typed struct using a complete Go program with explicit sample inputs.
Go✓ Tested
Encode a byte buffer as hexadecimal
C: Format each byte as an unsigned two-digit hexadecimal value.
C✓ Tested
Encode a struct with JSON field names
Encode a struct with JSON field names using a complete Go program with explicit sample inputs.
Go✓ Tested
Encode a value as little-endian bytes
Arduino / C: Store the least significant byte first when the protocol requires it.
Arduino / C✓ Tested
Encode and decode Base64 text
Encode and decode Base64 text using a complete Go program with explicit sample inputs.
Go✓ Tested
Encode and decode binary data as Base64
Python: Use Base64 when a text format must carry bytes; it is encoding, not encryption.
Python✓ Tested
Encode bytes as hexadecimal
Encode bytes as hexadecimal using a complete Go program with explicit sample inputs.
Go✓ Tested
Escape text for HTML content
Python: Use html.escape before placing plain text in an HTML text or quoted attribute context.
Python✓ Tested
Extract a substring with range syntax
C#: C# range ends are exclusive; indices operate on UTF-16 code units.
C#✓ Tested
Extract all integer tokens from text
C#: Enumerate Match objects returned by Regex.Matches with an explicit timeout.
C#✓ Tested
Extract all regex matches with their groups
JavaScript: matchAll requires a global regular expression and returns an iterator of matches.
JavaScript✓ Tested