Results for “number”
Small, practical examples. Search by task or narrow things down below.
Divide using a fractional number
C: Use a floating-point operand to preserve the fractional part of a division.
C✓ Tested
Extract numbers from text
Find all runs of ASCII digits in a string and convert the matches to integers.
regex✓ Tested
Filter even numbers
Use LINQ Where to keep even C# values.
C#✓ Tested
Filter even numbers
Use a Java stream to collect only even values.
Java✓ Tested
Filter even numbers
Create a JavaScript array containing only even values.
JavaScript✓ Tested
Find the number of days in a month
Python: Use calendar.monthrange to account for leap years.
Python✓ Tested
Find the number of days in a month
PowerShell: DaysInMonth handles leap-year February correctly.
PowerShell✓ Tested
Format a decimal number
Format a Java decimal with two digits and a fixed locale.
Java✓ Tested
Format a number with fixed decimal places
Format a number with fixed decimal places with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Generate a sequence of numbers
Create rows without a stored table.
generate_series✓ Tested
Generate numbers with a recursive CTE
Build a bounded sequence using SQL recursion.
recursive CTE✓ Tested
Limit the number of container processes
Docker / Compose: The pids-limit setting caps the container’s process count.
Docker / Compose✓ Tested