Results for “Accessible structure”
Small, practical examples. Search by task or narrow things down below.
Handle a malformed JSON document
PowerShell: ConvertFrom-Json reports a terminating conversion error under the selected error preference.
PowerShell✓ Tested
Handle malformed JSON input
Python: Catch JSONDecodeError without hiding unrelated programming errors.
Python✓ Tested
Inspect components of a URI
Java: Use URI parsing instead of splitting a URL at punctuation manually.
Java✓ Tested
Iterate over a fixed array of records
C: Compute the array element count with sizeof at the point where it is still an array.
C✓ Tested
Keep function state between calls
C: A static local variable retains its stored value for the lifetime of the process.
C✓ Tested
Measure UTF-8 bytes separately from characters
Java: Encode a Java string before measuring its serialized byte length.
Java✓ Tested
Pack and unpack a network-order integer
Python: Use an explicit byte order so the binary format is independent of the host architecture.
Python✓ Tested
Parse a bounded simple record with sscanf
C: A width limit protects the destination buffer and the consumed count detects trailing junk.
C✓ Tested
Parse a UUID and inspect its version
Java: Use UUID.fromString for a standard UUID value.
Java✓ Tested
Parse quoted CSV from an in-memory string
Python: Use StringIO with csv.reader so quoted commas are handled correctly.
Python✓ Tested
Pass a function as a callback
C: A typed function pointer permits behavior to be supplied to another function.
C✓ Tested
Process a FIFO queue
C#: Queue removes elements in the order they were enqueued.
C#✓ Tested