Results for “struct”
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
Encode a byte buffer as hexadecimal
C: Format each byte as an unsigned two-digit hexadecimal value.
C✓ Tested
Encode a form query parameter
Java: URLEncoder uses application/x-www-form-urlencoded rules, including plus signs for spaces.
Java✓ Tested
Encode and decode Base64 bytes
Java: Convert through UTF-8 explicitly before and after Base64 encoding.
Java✓ Tested
Encode and decode UTF-8 text with Base64
PowerShell: Convert the string to bytes explicitly before Base64 encoding.
PowerShell✓ Tested
Escape a single URL parameter value
PowerShell: EscapeDataString encodes one value without treating it as a complete URL.
PowerShell✓ Tested
Escape plain text before placing it in HTML
PowerShell: HtmlEncode converts HTML delimiters to entities in ordinary text contexts.
PowerShell✓ Tested
Expose a disclosure button’s expanded state
HTML: Keep aria-expanded synchronized with the controlled panel’s hidden state.
HTML✓ Tested
Find values common to two collections
C#: Intersect returns distinct values shared by the inputs.
C#✓ Tested
Find values missing from another collection
C#: Except removes duplicates as it calculates the set difference.
C#✓ Tested
Flatten a single nesting level
JavaScript: flat defaults to a depth of one and creates a new array.
JavaScript✓ Tested
Flatten a single nesting level
TypeScript: flat defaults to a depth of one and creates a new array.
TypeScript✓ Tested