FIND YOUR NEXT FEW LINES

Results for “struct”

Small, practical examples. Search by task or narrow things down below.

152 snippets foundClear filters
PythonStructured data & serialization

Read elements from trusted XML

Python: Use ElementTree to inspect a small trusted XML document.

Python✓ Tested
PowerShellStructured formats & encodings

Read JSON into a hashtable

PowerShell: AsHashtable produces dictionary-style results for keys that are data rather than fixed property names.

PowerShell✓ Tested
PythonStructured data & serialization

Read one JSON document per line

Python: Parse nonempty JSON Lines records independently instead of loading a JSON array.

Python✓ Tested
HTMLAccessible structure

Remove an inactive section from keyboard navigation

HTML: Inert prevents interaction and accessibility exposure for an inactive subtree.

HTML✓ Tested
C#Collections & data structures

Remove matching items from a mutable list

C#: List.RemoveAll returns how many items it removed.

C#✓ Tested
JavaScriptArray restructuring

Replace an array segment in place

JavaScript: splice returns removed items and inserts replacements at the chosen position.

JavaScript✓ Tested
TypeScriptArray restructuring

Replace an array segment in place

TypeScript: splice returns removed items and inserts replacements at the chosen position.

TypeScript✓ Tested
PythonStructured data & serialization

Represent a record with a dataclass

Python: Generate initialization and convert a typed record to a dictionary.

Python✓ Tested
CStructures & function interfaces

Represent a small set of named states

C: An enum gives symbolic names to integer state values.

C✓ Tested
PythonStructured data & serialization

Return a small immutable named record

Python: Use NamedTuple when callers need both tuple behavior and named fields.

Python✓ Tested
CStructures & function interfaces

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
JavaScriptArray restructuring

Reverse a copy while preserving the original

JavaScript: Copy before reverse because reverse mutates the array it receives.

JavaScript✓ Tested