FIND YOUR NEXT FEW LINES

Results for “Numbers & numeric validation”

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

266 snippets foundClear filters
Linux CommandsSorting & joining records

Sort values in descending order

Linux Commands: Combine numeric sorting with reverse order.

Linux Commands✓ Tested
Linux CommandsSorting & joining records

Sort version-like labels naturally

Linux Commands: Use GNU version sort to compare embedded digit runs numerically.

Linux Commands✓ Tested
Linux CommandsStreams & byte tools

Split a file into fixed line-count pieces

Linux Commands: Use numeric suffixes for predictable filenames when splitting a large text file.

Linux Commands✓ Tested
PowerShellCollections & objects

Sum a collection

Calculate a total with Measure-Object.

Measure-Object✓ Tested
Bash ScriptsLoops & decisions

Sum a range of integers

Use an arithmetic loop without launching external processes.

arithmetic✓ Tested
JavaNumbers & dates

Sum integer values

Reduce a Java integer stream to its sum.

Java✓ Tested
TypeScriptCollections & records

Sum typed values with reduce

Accumulate numeric array elements.

reduce✓ Tested
C++Numbers & algorithms

Sum vector values

Use std::accumulate with a wide initial value.

C++✓ Tested
CNumbers & memory

Swap two integers

Use a temporary value to swap C integers without arithmetic overflow.

C✓ Tested
TypeScriptTypes & functions

Type a function’s inputs and output

Catch mismatched arguments during compilation.

function✓ Tested
JavaNumbers & dates

Use an optional fallback

Use Optional.orElse to provide a default for a missing Java value.

Java✓ Tested
Arduino / CArrays & embedded state

Use named states for a controller

Arduino / C: An enum makes state transitions easier to read than unexplained numbers.

Arduino / C✓ Tested