Results for “library”
Small, practical examples. Search by task or narrow things down below.
Bind a value with let
Bind a value with let in a complete Rust program using the standard library.
Rust✓ Tested
Borrow local data in a scoped thread
Borrow local data in a scoped thread in a complete Rust program using the standard library.
Rust✓ Tested
Borrow text until a modification is needed
Borrow text until a modification is needed in a complete Rust program using the standard library.
Rust✓ Tested
Borrow text without transferring ownership
Borrow text without transferring ownership in a complete Rust program using the standard library.
Rust✓ Tested
Build a URL query string
Python: Use urlencode to percent-encode query parameter values correctly.
Python✓ Tested
Build text efficiently in a loop
Java: Append to StringBuilder when constructing a string incrementally.
Java✓ Tested
Build text incrementally
Build text incrementally using a complete Go program with explicit sample inputs.
Go✓ Tested
Cache repeated pure function calls
Python: Use lru_cache to avoid recomputing results for identical hashable arguments.
Python✓ Tested
Calculate a SHA-256 content digest
Java: Hash UTF-8 bytes and format the result as lowercase hexadecimal.
Java✓ Tested
Calculate a SHA-256 text digest
Calculate a SHA-256 text digest using a complete Go program with explicit sample inputs.
Go✓ Tested
Calculate a simple total
Python: Multiply a unit price by a quantity, then add a delivery fee.
Python✓ Tested
Calculate a simple total
Java: Multiply a unit price by a quantity, then add a delivery fee.
Java✓ Tested