FIND YOUR NEXT FEW LINES

Results for “standard”

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

703 snippets foundClear filters
C#Getting Started

Replace one collection element

C#: Update an existing element at a known valid index.

C#✓ 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
Linux CommandsText processing

Replace text with sed

Replace all occurrences of the substring old on each line and print the transformed text without changing the input file.

sed✓ Tested
C++Strings

Replace the first match

Find and replace one literal substring in C++.

C++✓ 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
C#Getting Started

Require two conditions to be true

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

C#✓ 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
C#Asynchronous work & URI handling

Resolve a relative URI against a base

C#: Use a base URI ending in a slash when the final path component represents a directory.

C#✓ Tested