FIND YOUR NEXT FEW LINES

Results for “library”

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

653 snippets foundClear filters
GoFiles & paths

Copy a stream and count its bytes

Copy a stream and count its bytes using a complete Go program with explicit sample inputs.

Go✓ Tested
GoMaps & sets

Copy entries into another map

Copy entries into another map using a complete Go program with explicit sample inputs.

Go✓ Tested
PythonMappings & sets

Copy nested mutable data independently

Python: Use deepcopy when changes to nested lists must not affect the original object.

Python✓ Tested
CStrings

Copy text into a fixed buffer

Use snprintf and check for truncation when copying a C string.

C✓ Tested
PythonDates & time zones

Count days between calendar dates

Python: Subtract date objects to get an exact calendar-day difference.

Python✓ Tested
JavaDates & time zones

Count days between two dates

Java: Use ChronoUnit.DAYS for an elapsed count rather than a Period day component.

Java✓ Tested
jQueryGetting Started

Count matched elements

jQuery: Learn how to count matched elements in a complete browser example.

jQuery✓ Tested
CArrays

Count matching values

Count even numbers in a fixed C array.

C✓ Tested
CFiles

Count newline characters

Count newline bytes in a C file while retaining EOF as an int.

C✓ Tested
PythonCollections

Count occurrences in a list

Count how often each value appears using Counter from the standard library.

count✓ Tested
GoMaps & sets

Count repeated words

Count repeated words using a complete Go program with explicit sample inputs.

Go✓ Tested
PythonGetting Started

Count the items in a collection

Python: Read the collection’s length instead of hard-coding the loop limit.

Python✓ Tested