Results for “struct”
Small, practical examples. Search by task or narrow things down below.
Read elements from trusted XML
Python: Use ElementTree to inspect a small trusted XML document.
Python✓ Tested
Read JSON into a hashtable
PowerShell: AsHashtable produces dictionary-style results for keys that are data rather than fixed property names.
PowerShell✓ Tested
Read one JSON document per line
Python: Parse nonempty JSON Lines records independently instead of loading a JSON array.
Python✓ Tested
Remove an inactive section from keyboard navigation
HTML: Inert prevents interaction and accessibility exposure for an inactive subtree.
HTML✓ Tested
Remove matching items from a mutable list
C#: List.RemoveAll returns how many items it removed.
C#✓ Tested
Replace an array segment in place
JavaScript: splice returns removed items and inserts replacements at the chosen position.
JavaScript✓ Tested
Replace an array segment in place
TypeScript: splice returns removed items and inserts replacements at the chosen position.
TypeScript✓ Tested
Represent a record with a dataclass
Python: Generate initialization and convert a typed record to a dictionary.
Python✓ Tested
Represent a small set of named states
C: An enum gives symbolic names to integer state values.
C✓ Tested
Return a small immutable named record
Python: Use NamedTuple when callers need both tuple behavior and named fields.
Python✓ Tested
Return a status separately from a calculated result
C: An output pointer lets a function return success or failure independently of its numeric result.
C✓ Tested
Reverse a copy while preserving the original
JavaScript: Copy before reverse because reverse mutates the array it receives.
JavaScript✓ Tested