Results for “length”
Small, practical examples. Search by task or narrow things down below.
Measure the length of ordinary text
SQLite: Use the engine’s text-length function; this ASCII example has no trailing spaces.
SQLite✓ Tested
Read a file length in bytes
Java: Files.size inspects metadata without loading the file into a Java string.
Java✓ Tested
Read a string’s character length
Bash Scripts: Bash parameter length counts characters under the current locale.
Bash Scripts✓ Tested
Read the length of an ASCII string
Bash Scripts: Read the length of an ASCII string with a small standalone Bash program.
Bash Scripts✓ Tested
Require a minimum text length
Require a minimum text length with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Set a file to a specific byte length
Linux Commands: Use truncate to shorten a known scratch file without replacing its inode.
Linux Commands✓ Tested
Store a variable-length payload after a structure header
C: A flexible array member lets one allocation hold metadata and trailing bytes.
C✓ Tested
Count array elements
Bash Scripts: Count array elements with a small standalone Bash program.
Bash Scripts✓ Tested
Count the elements in an array
Bash Scripts: The array length form counts assigned elements, not characters in the first value.
Bash Scripts✓ Tested
Count the items in a collection
Python: Read the collection’s length instead of hard-coding the loop limit.
Python✓ Tested
Count the items in a collection
C#: Read the collection’s length instead of hard-coding the loop limit.
C#✓ Tested
Count the items in a collection
Java: Read the collection’s length instead of hard-coding the loop limit.
Java✓ Tested