FIND YOUR NEXT FEW LINES

Results for “Bulk changes & set operations”

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

686 snippets foundClear filters
TypeScriptUTC date operations

Read an ISO-style weekday number

TypeScript: Convert Sunday from zero to seven when using Monday-through-Sunday numbering.

TypeScript✓ Tested
PythonMappings & sets

Read an optional dictionary key

Python: Use get with a fallback while leaving the dictionary unchanged.

Python✓ Tested
PythonFile operations & archives

Read compressed text directly

Python: Open gzip data in text mode with an explicit encoding.

Python✓ Tested
JavaScriptUTC date operations

Read date components in UTC

JavaScript: UTC accessors avoid differences caused by the machine’s local timezone.

JavaScript✓ Tested
TypeScriptUTC date operations

Read date components in UTC

TypeScript: UTC accessors avoid differences caused by the machine’s local timezone.

TypeScript✓ Tested
C++Filesystem operations

Read the byte size of a regular file

C++: file_size reads filesystem metadata without loading file contents.

C++✓ Tested
PowerShellArray operations

Read the last array element

PowerShell: A negative array index counts backward from the end.

PowerShell✓ Tested
Bash ScriptsProcesses & environment

Remove a variable from one child’s environment

Bash Scripts: env -u removes an inherited value for a single command.

Bash Scripts✓ Tested
RustMaps & sets

Remove an entry and inspect its value

Remove an entry and inspect its value in a complete Rust program using the standard library.

Rust✓ Tested
PythonMappings & sets

Remove and return a dictionary entry

Python: Use pop with a default when a missing entry is an expected condition.

Python✓ Tested
JavaQueues & collection operations

Remove collection items that satisfy a condition

Java: Use removeIf on a mutable collection to avoid changing it manually inside a for-each loop.

Java✓ Tested
PythonFile operations & archives

Rename a file within a directory

Python: Use Path.rename and inspect the resulting path.

Python✓ Tested