FIND YOUR NEXT FEW LINES
Results for “Numbers & durations”
Small, practical examples. Search by task or narrow things down below.
80 snippets foundClear filters
Search for text in a file
Find matching lines with their line numbers, ignoring letter case and treating the pattern as literal text.
grep✓ Tested
Set and test bit flags
Use unsigned masks to combine and test C flags.
C✓ Tested
Sum a range of integers
Use an arithmetic loop without launching external processes.
arithmetic✓ Tested
Sum integer values
Reduce a Java integer stream to its sum.
Java✓ Tested
Sum vector values
Use std::accumulate with a wide initial value.
C++✓ Tested
Swap two integers
Use a temporary value to swap C integers without arithmetic overflow.
C✓ Tested
Use an optional fallback
Use Optional.orElse to provide a default for a missing Java value.
Java✓ Tested
Use named states for a controller
Arduino / C: An enum makes state transitions easier to read than unexplained numbers.
Arduino / C✓ Tested