FIND YOUR NEXT FEW LINES

Results for “Containers & compound values”

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

432 snippets foundClear filters
C#Strings

Split and trim values

Split simple comma-separated C# text and trim each value.

C#✓ Tested
C#LINQ transformations

Split values into fixed-size chunks

C#: Enumerable.Chunk creates arrays and allows a shorter final chunk.

C#✓ Tested
Bash ScriptsInput streams & redirection

Substitute values into a multiline template

Bash Scripts: An unquoted heredoc delimiter enables parameter expansion in the template.

Bash Scripts✓ Tested
CArrays

Sum array values

Iterate over a fixed C array using a size-derived element count.

C✓ Tested
C#Data & dates

Sum integer values

Sum a C# sequence using LINQ.

C#✓ Tested
JavaNumbers & dates

Sum integer values

Reduce a Java integer stream to its sum.

Java✓ Tested
JavaScriptArrays

Sum numeric values

Provide an initial accumulator for JavaScript reduce, including empty arrays.

JavaScript✓ Tested
TypeScriptCollections & records

Sum typed values with reduce

Accumulate numeric array elements.

reduce✓ Tested
SQLExpressions & aggregates

Sum values per category

Calculate a grouped total.

SUM✓ Tested
C++Numbers & algorithms

Sum vector values

Use std::accumulate with a wide initial value.

C++✓ Tested
PythonIteration & sequences

Take a limited number of iterator values

Python: Use islice to consume only the requested prefix of a potentially unbounded iterator.

Python✓ Tested
SQLChange & combine data

Test missing values with IS NULL

Find rows where an optional value is absent.

IS NULL✓ Tested