FIND YOUR NEXT FEW LINES

Results for “tr”

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

1534 snippets foundClear filters
JavaGetting Started

Convert known numeric text to an integer

Java: Convert a trusted literal to an integer before adding. Validate external input before converting it.

Java✓ Tested
JavaScriptGetting Started

Convert known numeric text to an integer

JavaScript: Convert a trusted literal to an integer before adding. Validate external input before converting it.

JavaScript✓ Tested
TypeScriptGetting Started

Convert known numeric text to an integer

TypeScript: Convert a trusted literal to an integer before adding. Validate external input before converting it.

TypeScript✓ Tested
C++Getting Started

Convert known numeric text to an integer

C++: Convert a trusted literal to an integer before adding. Validate external input before converting it.

C++✓ Tested
CGetting Started

Convert known numeric text to an integer

C: Convert a trusted literal to an integer before adding. Validate external input before converting it.

C✓ Tested
Arduino / CSerial protocols

Convert received ASCII letters to uppercase

Arduino / C: ctype functions should receive an unsigned character value.

Arduino / C✓ Tested
C++Filesystem operations

Copy a file without replacing an existing destination

C++: The default copy_file policy refuses to overwrite an existing destination.

C++✓ Tested
Arduino / CDigital signals & interrupts

Copy a multibyte interrupt-owned counter atomically

Arduino / C: ATOMIC_RESTORESTATE restores the interrupt state after reading a shared value.

Arduino / C✓ Tested
CStrings

Copy text into a fixed buffer

Use snprintf and check for truncation when copying a C string.

C✓ Tested
GitRestoring & revising local work

Correct the latest unpublished commit message

Git: Amend replaces the current commit while preserving its tree when no new changes are staged.

Git✓ Tested
Arduino / CDigital signals & interrupts

Count a button’s falling edge in the main loop

Arduino / C: Compare each reading with the previous state to detect transitions.

Arduino / C✓ Tested
Arduino / CDigital input & output

Count a falling edge with an interrupt

Increment a counter when an external input changes.

attachInterrupt✓ Tested