FIND YOUR NEXT FEW LINES

Results for “library”

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

653 snippets foundClear filters
JavaGetting Started

Measure a short text value

Java: Read the length of an ASCII string. Non-ASCII text may use multiple code units or bytes depending on the language.

Java✓ Tested
CStrings

Measure a string length

Count bytes before the null terminator with C strlen.

C✓ Tested
jQueryCollections & styling

Measure content, padding, and borders separately

jQuery: width, innerWidth, and outerWidth measure different parts of the box.

jQuery✓ Tested
JavaEncoding & structured values

Measure UTF-8 bytes separately from characters

Java: Encode a Java string before measuring its serialized byte length.

Java✓ Tested
PythonCollections

Merge two dictionaries

Combine two dictionaries into a new dictionary. When a key appears in both inputs, the value from the second dictionary wins.

dictionary✓ Tested
RustGetting Started

Modify a value through a mutable borrow

Modify a value through a mutable borrow in a complete Rust program using the standard library.

Rust✓ Tested
RustTesting & reusable patterns

Move a collection out and leave an empty default

Move a collection out and leave an empty default in a complete Rust program using the standard library.

Rust✓ Tested
JavaFile operations & binary data

Move a file to a new name

Java: Files.move changes the path and returns the destination Path.

Java✓ Tested
jQueryInsertion & wrapping

Move a node without losing its event handler

jQuery: detach retains jQuery data and events for reinsertion.

jQuery✓ Tested
RustThreads & shared ownership

Move owned data into a worker

Move owned data into a worker in a complete Rust program using the standard library.

Rust✓ Tested
GoFunctions & types

Mutate a struct through a pointer receiver

Mutate a struct through a pointer receiver using a complete Go program with explicit sample inputs.

Go✓ Tested
GoGetting Started

Name a fixed configuration value

Name a fixed configuration value using a complete Go program with explicit sample inputs.

Go✓ Tested