FIND YOUR NEXT FEW LINES

The snippet library.

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

3000 snippets foundClear filters
C++Getting Started

Repeat while a condition holds

C++: Count down while a positive number remains, updating the loop variable on each iteration.

C++✓ Tested
CGetting Started

Repeat while a condition holds

C: Count down while a positive number remains, updating the loop variable on each iteration.

C✓ Tested
SQLText cleanup & matching

Replace a literal substring

SQL: REPLACE performs a literal replacement rather than a regular-expression substitution.

SQL✓ Tested
SQL ServerText cleanup & matching

Replace a literal substring

SQL Server: REPLACE performs a literal replacement rather than a regular-expression substitution.

SQL Server✓ Tested
PostgresText cleanup & matching

Replace a literal substring

Postgres: REPLACE performs a literal replacement rather than a regular-expression substitution.

Postgres✓ Tested
SQLiteText cleanup & matching

Replace a literal substring

SQLite: REPLACE performs a literal replacement rather than a regular-expression substitution.

SQLite✓ Tested
RustStrings & Unicode

Replace a literal substring

Replace a literal substring in a complete Rust program using the standard library.

Rust✓ Tested
PowerShellGetting Started

Replace a literal word in text

PowerShell: Replace a literal word in text using PowerShell 7.

PowerShell✓ Tested
PostgresJSON & arrays

Replace a nested JSONB value

Change one path with jsonb_set.

jsonb_set✓ Tested
C#File operations & paths

Replace a path extension

C#: Path.ChangeExtension transforms a path string without moving or creating a file.

C#✓ Tested
AngularServices & dependency injection

Replace a service implementation with useClass

Replace a service implementation with useClass with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
AngularSignals & state

Replace a signal’s value explicitly

Replace a signal’s value explicitly with a standalone Angular component and explicit browser behavior.

Angular✓ Tested