Results for “standard”
Small, practical examples. Search by task or narrow things down below.
Normalize equivalent Unicode strings
Python: Normalize to NFC before comparing canonically equivalent text.
Python✓ Tested
Normalize relative path components
Java: Path.normalize removes redundant dot components without accessing the filesystem.
Java✓ Tested
Number items while iterating
Python: Use enumerate to attach a one-based position without maintaining a separate counter.
Python✓ Tested
Number items while iterating
Number items while iterating in a complete Rust program using the standard library.
Rust✓ Tested
Observe cancellation through a token
C#: A cancellation token is cooperative; operations must check it or accept it as an argument.
C#✓ Tested
Observe context cancellation
Observe context cancellation using a complete Go program with explicit sample inputs.
Go✓ Tested
Own a heap-allocated value with Box
Own a heap-allocated value with Box in a complete Rust program using the standard library.
Rust✓ 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
Pad a numeric label to a fixed width
C#: Use a numeric format specifier to add leading zeroes.
C#✓ Tested
Pair corresponding collection elements
C#: Zip stops at the shorter sequence, so validate lengths separately if mismatches are an error.
C#✓ Tested
Pair corresponding list items
Python: Zip two equally sized sequences into pairs; strict mode rejects mismatched lengths on Python 3.10 or later.
Python✓ Tested
Pair corresponding values
Pair corresponding values in a complete Rust program using the standard library.
Rust✓ Tested