Results for “library”
Small, practical examples. Search by task or narrow things down below.
Replace one collection element
Python: Update an existing element at a known valid index.
Python✓ Tested
Replace one collection element
Java: Update an existing element at a known valid index.
Java✓ Tested
Replace text in a string
Replace every occurrence of a substring and keep the result in a new string. The original string is unchanged.
string✓ Tested
Replace the first match
Find and replace one literal substring in C++.
C++✓ Tested
Report progress before completion
jQuery: notify calls registered progress handlers while the deferred is pending.
jQuery✓ Tested
Represent a finite set of states
Java: Use an enum to prevent arbitrary strings from representing application states.
Java✓ Tested
Represent a record with a dataclass
Python: Generate initialization and convert a typed record to a dictionary.
Python✓ Tested
Represent a set with empty structs
Represent a set with empty structs using a complete Go program with explicit sample inputs.
Go✓ Tested
Require two conditions to be true
Python: Combine a lower and an upper bound to check whether a value is in range.
Python✓ Tested
Require two conditions to be true
Java: Combine a lower and an upper bound to check whether a value is in range.
Java✓ Tested
Resolve a deferred result
jQuery: done receives the value supplied to resolve.
jQuery✓ Tested
Resolve a relative URL
Resolve a relative URL using a complete Go program with explicit sample inputs.
Go✓ Tested