FIND YOUR NEXT FEW LINES

Results for “library”

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

653 snippets foundClear filters
PythonGetting Started

Replace one collection element

Python: Update an existing element at a known valid index.

Python✓ Tested
JavaGetting Started

Replace one collection element

Java: Update an existing element at a known valid index.

Java✓ Tested
PythonStrings & dates

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
C++Strings

Replace the first match

Find and replace one literal substring in C++.

C++✓ Tested
jQueryDeferred work & queues

Report progress before completion

jQuery: notify calls registered progress handlers while the deferred is pending.

jQuery✓ Tested
JavaRecords & reliable control flow

Represent a finite set of states

Java: Use an enum to prevent arbitrary strings from representing application states.

Java✓ Tested
PythonStructured data & serialization

Represent a record with a dataclass

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

Python✓ Tested
GoMaps & sets

Represent a set with empty structs

Represent a set with empty structs using a complete Go program with explicit sample inputs.

Go✓ Tested
PythonGetting Started

Require two conditions to be true

Python: Combine a lower and an upper bound to check whether a value is in range.

Python✓ Tested
JavaGetting Started

Require two conditions to be true

Java: Combine a lower and an upper bound to check whether a value is in range.

Java✓ Tested
jQueryDeferred work & queues

Resolve a deferred result

jQuery: done receives the value supplied to resolve.

jQuery✓ Tested
GoHTTP & URLs

Resolve a relative URL

Resolve a relative URL using a complete Go program with explicit sample inputs.

Go✓ Tested