Results for “nonempty”
Small, practical examples. Search by task or narrow things down below.
Check that a file is present and nonempty
Test file content availability before reading it.
file check✓ Tested
Find the smallest value in a nonempty array
C: Initialize from the first element instead of assuming a numeric sentinel.
C✓ Tested
Require a nonempty text value
HTML: The required attribute makes an empty text control fail native constraint validation.
HTML✓ Tested
Rotate a nonempty array left by one element
C: Save the first item before shifting the remaining elements.
C✓ Tested
Use an alternate value only when a variable is nonempty
Bash Scripts: The colon-plus expansion returns its word only when the parameter has a nonempty value.
Bash Scripts✓ Tested
Reject a missing required configuration value
Bash Scripts: Check a required value explicitly and emit a controlled diagnostic before exiting.
Bash Scripts✓ Tested
Find a sample range in one pass
Arduino / C: Initialize extrema from the first element of a nonempty array.
Arduino / C✓ Tested
Find both extremes in one algorithm call
C++: Check for a nonempty input before dereferencing the returned iterators.
C++✓ Tested
Find the largest array value
Track the maximum in a nonempty C integer array.
C✓ Tested
Read a file without losing its last line
Handle spaces, backslashes, and a final line without a newline.
read lines✓ Tested
Read one JSON document per line
Python: Parse nonempty JSON Lines records independently instead of loading a JSON array.
Python✓ Tested
Read the beginning of a text value
Python: Extract or display the first three ASCII characters from a known nonempty string.
Python✓ Tested