FIND YOUR NEXT FEW LINES

Results for “standard”

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

703 snippets foundClear filters
RustFunctions & data types

Wrap a value in a distinct type

Wrap a value in a distinct type in a complete Rust program using the standard library.

Rust✓ Tested
GoErrors & validation

Wrap an error with context

Wrap an error with context using a complete Go program with explicit sample inputs.

Go✓ Tested
C#Types & reliable control flow

Write a generic first-or-fallback helper

C#: Constrain a generic helper through its input shape and return an explicit caller-supplied fallback.

C#✓ Tested
GoFunctions & types

Write a generic slice helper

Write a generic slice helper using a complete Go program with explicit sample inputs.

Go✓ Tested
PythonJSON & CSV

Write a JSON file

Save a dictionary as readable, indented JSON while preserving Unicode characters.

json✓ Tested
PythonFiles & paths

Write a text file

Save a string to a UTF-8 text file and close the file automatically when the write finishes.

file✓ Tested
C#Files & paths

Write a text file

Write a C# string to a UTF-8 file.

C#✓ Tested
C++Files & paths

Write a text file

Write and close a C++ output file while checking stream failure.

C++✓ Tested
CFiles

Write a text file

Open, write, and close a C file while checking every operation.

C✓ Tested
JavaFiles & paths

Write a UTF-8 file

Write a Java string to a file using an explicit text encoding.

Java✓ Tested
GoFiles & paths

Write and read a UTF-8 file

Write and read a UTF-8 file using a complete Go program with explicit sample inputs.

Go✓ Tested
RustFiles & paths

Write and read a UTF-8 file

Write and read a UTF-8 file in a complete Rust program using the standard library.

Rust✓ Tested