Results for “Errors & optional values”
Small, practical examples. Search by task or narrow things down below.
Clear a flag without affecting neighboring bits
Arduino / C: bitClear resets only the selected bit.
Arduino / C✓ Tested
Convert bytes to hexadecimal and back
Java: Use HexFormat for a standard-library representation of raw bytes.
Java✓ Tested
Decode a form query parameter
Java: URLDecoder reverses form encoding and treats plus as a space.
Java✓ Tested
Display a specific reactive validation error
Display a specific reactive validation error with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Encode a form query parameter
Java: URLEncoder uses application/x-www-form-urlencoded rules, including plus signs for spaces.
Java✓ 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 bytes
Java: Convert through UTF-8 explicitly before and after Base64 encoding.
Java✓ Tested
Extract the low and high byte of a value
Arduino / C: lowByte and highByte expose the two bytes of a 16-bit value.
Arduino / C✓ Tested
Insert a map value only when a key is absent
C++: try_emplace preserves the old value when insertion does not take place.
C++✓ Tested
Inspect a typed conversion error
Inspect a typed conversion error using a complete Go program with explicit sample inputs.
Go✓ Tested
Inspect components of a URI
Java: Use URI parsing instead of splitting a URL at punctuation manually.
Java✓ Tested
Measure UTF-8 bytes separately from characters
Java: Encode a Java string before measuring its serialized byte length.
Java✓ Tested