FIND YOUR NEXT FEW LINES

Results for “safe”

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

34 snippets foundClear filters
jQueryGetting Started

Append a safely constructed list item

jQuery: Learn how to append a safely constructed list item in a complete browser example.

jQuery✓ Tested
Linux CommandsArchive integrity & packaging

Archive filenames safely with null delimiters

Linux Commands: Use find -print0 with tar --null to preserve spaces and embedded newlines in filenames.

Linux Commands✓ Tested
JavaScriptNumbers & numeric validation

Check whether a value is a safe integer

JavaScript: Number.isSafeInteger also checks the exact-integer range supported by Number.

JavaScript✓ Tested
TypeScriptNumbers & numeric validation

Check whether a value is a safe integer

TypeScript: Number.isSafeInteger also checks the exact-integer range supported by Number.

TypeScript✓ Tested
C++Text validation & parsing

Convert ASCII text to lowercase safely

C++: Cast each byte to unsigned char before using the cctype function.

C++✓ Tested
CBinary formats & structured parsing

Convert ASCII text to lowercase safely

C: Cast to unsigned char before calling ctype functions on a possibly signed char.

C✓ Tested
C++Tasks & synchronization

Increment a shared counter safely

C++: Atomic increments prevent lost updates when two threads change the same counter.

C++✓ Tested
Arduino / CData & storage

Limit a value to a safe interval

Clamp an integer between chosen endpoints.

constrain✓ Tested
Bash ScriptsLoops & decisions

Loop over an array safely

Preserve spaces in array elements while iterating.

array✓ Tested
CStrings & byte buffers

Move overlapping bytes safely

C: memmove supports overlapping ranges, unlike memcpy.

C✓ Tested
JavaNumbers & dates

Parse an integer safely

Handle invalid Java integer input with NumberFormatException.

Java✓ Tested
Linux CommandsGetting Started

Print separate arguments safely

Linux Commands: Print separate arguments safely using GNU/Linux commands in an empty practice directory.

Linux Commands✓ Tested