FIND YOUR NEXT FEW LINES

Results for “length”

Small, practical examples. Search by task or narrow things down below.

64 snippets foundClear filters
Arduino / CText & bounded buffers

Detect truncated formatted output

Arduino / C: snprintf returns the length it would have written, excluding the null terminator.

Arduino / C✓ Tested
C++Text validation & parsing

Extract a substring with an explicit count

C++: The second substr argument is a length rather than an ending index.

C++✓ Tested
SQL ServerDates & text

Find the final day of a month

Use EOMONTH without manually calculating month length.

EOMONTH✓ Tested
JavaDates & time zones

Find the last day of a month

Java: Use YearMonth so leap years and month lengths are handled by the calendar library.

Java✓ Tested
CArray transformations

Insert into an array with spare capacity

C: Move the trailing elements before inserting and keep the logical length separate from capacity.

C✓ Tested
CSSResponsive conditions & sizing

Keep a viewport-relative size above a minimum

CSS: Max selects the larger of the candidate lengths.

CSS✓ Tested
JavaEncoding & structured values

Measure UTF-8 bytes separately from characters

Java: Encode a Java string before measuring its serialized byte length.

Java✓ Tested
JavaScriptArray traversal & selection

Pair corresponding array items by position

JavaScript: Validate equal lengths before zipping when missing counterparts would be an error.

JavaScript✓ Tested
TypeScriptArray traversal & selection

Pair corresponding array items by position

TypeScript: Validate equal lengths before zipping when missing counterparts would be an error.

TypeScript✓ Tested
C#LINQ transformations

Pair corresponding collection elements

C#: Zip stops at the shorter sequence, so validate lengths separately if mismatches are an error.

C#✓ Tested
PythonIteration & sequences

Pair corresponding list items

Python: Zip two equally sized sequences into pairs; strict mode rejects mismatched lengths on Python 3.10 or later.

Python✓ Tested
PowerShellArray operations

Pair corresponding values from two arrays

PowerShell: Check lengths before indexing to reject mismatched input collections.

PowerShell✓ Tested