FIND YOUR NEXT FEW LINES

Results for “as”

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

2533 snippets foundClear filters
JavaScriptText handling & Unicode

Transform each regex match with a callback

JavaScript: A replacement callback computes the replacement separately for each match.

JavaScript✓ Tested
JavaScriptText handling & Unicode

Trim and discard blank lines

JavaScript: Split a text block, trim each line, and keep nonempty values.

JavaScript✓ Tested
JavaScriptStrings

Trim surrounding whitespace

Remove leading and trailing JavaScript string whitespace.

JavaScript✓ Tested
SQLGetting Started

Turn a condition into a result label

SQL: Use CASE to describe stock availability for each row.

SQL✓ Tested
SQL ServerGetting Started

Turn a condition into a result label

SQL Server: Use CASE to describe stock availability for each row.

SQL Server✓ Tested
PostgresGetting Started

Turn a condition into a result label

Postgres: Use CASE to describe stock availability for each row.

Postgres✓ Tested
SQLiteGetting Started

Turn a condition into a result label

SQLite: Use CASE to describe stock availability for each row.

SQLite✓ Tested
JavaScriptGetting Started

Update a running count

JavaScript: Change a variable after its initial value has been assigned.

JavaScript✓ Tested
Bash ScriptsGetting Started

Use a fallback for an unset variable

Bash Scripts: Use a fallback for an unset variable with a small standalone Bash program.

Bash Scripts✓ Tested
Bash ScriptsFunction scope & composition

Use a recursive function for a bounded calculation

Bash Scripts: A recursive factorial demonstrates local variables and a clear base case.

Bash Scripts✓ Tested
Bash ScriptsParameter expansion

Use an alternate value only when a variable is nonempty

Bash Scripts: The colon-plus expansion returns its word only when the parameter has a nonempty value.

Bash Scripts✓ Tested
JavaScriptPromises & iteration protocols

Use the first fulfilled promise result

JavaScript: Promise.any ignores individual rejections until one input fulfills.

JavaScript✓ Tested