Results for “COUNT”
Small, practical examples. Search by task or narrow things down below.
Iterate with array indices and values
TypeScript: entries provides each position and value without a separate counter.
TypeScript✓ Tested
Keep loop state by avoiding a pipeline subshell
Bash Scripts: Redirect input into a while loop so updates to a counter remain in the current shell.
Bash Scripts✓ Tested
Limit the number of container processes
Docker / Compose: The pids-limit setting caps the container’s process count.
Docker / Compose✓ Tested
Measure a string length
Count bytes before the null terminator with C strlen.
C✓ Tested
Measure the byte length of UTF-8 text
C#: Character count and encoded byte count can differ for non-ASCII text.
C#✓ Tested
Number items while iterating
Python: Use enumerate to attach a one-based position without maintaining a separate counter.
Python✓ Tested
Pair corresponding array items by position
JavaScript: Validate equal lengths before zipping when missing counterparts would be an error.
JavaScript✓ Tested
Pair corresponding array items by position
TypeScript: Validate equal lengths before zipping when missing counterparts would be an error.
TypeScript✓ Tested
Parse a bounded simple record with sscanf
C: A width limit protects the destination buffer and the consumed count detects trailing junk.
C✓ Tested
Preserve equal-key order while sorting records
C++: stable_sort retains encounter order for records whose selected sort keys compare equal.
C++✓ Tested
Push a new branch and set its upstream
Connect a feature branch with its remote counterpart.
push✓ Tested
Read a string’s character length
Bash Scripts: Bash parameter length counts characters under the current locale.
Bash Scripts✓ Tested