FIND YOUR NEXT FEW LINES

Results for “string”

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

203 snippets foundClear filters
PowerShellFunctions & control

Choose an action with switch

Map a small command value to a result.

switch✓ Tested
Arduino / CSerial communication

Collect a serial line in a fixed buffer

Read a short command without dynamic String allocation.

serial line✓ Tested
Arduino / CText & bounded buffers

Compare a command case-sensitively

Arduino / C: strcmp returns zero when both null-terminated strings match.

Arduino / C✓ Tested
CStrings

Convert ASCII text to uppercase

Convert characters with toupper while avoiding signed-char undefined behavior.

C✓ Tested
JavaScriptNumbers & numeric validation

Convert between integer bases

JavaScript: Supply a radix when parsing a nondecimal integer string.

JavaScript✓ Tested
TypeScriptNumbers & numeric validation

Convert between integer bases

TypeScript: Supply a radix when parsing a nondecimal integer string.

TypeScript✓ Tested
CStrings

Copy text into a fixed buffer

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

C✓ Tested
C#JSON & binary formats

Decode hexadecimal bytes

C#: FromHexString and ToHexString handle binary data without manually parsing pairs of characters.

C#✓ Tested
JavaScriptNumbers & numeric validation

Detect NaN without converting the input

JavaScript: Number.isNaN tests the special numeric value instead of applying string-to-number conversion.

JavaScript✓ Tested
TypeScriptNumbers & numeric validation

Detect NaN without converting the input

TypeScript: Number.isNaN tests the special numeric value instead of applying string-to-number conversion.

TypeScript✓ Tested
JavaScriptNumbers & numeric validation

Display a number with a fixed decimal width

JavaScript: toFixed returns a formatted string rather than a numeric value.

JavaScript✓ Tested
TypeScriptNumbers & numeric validation

Display a number with a fixed decimal width

TypeScript: toFixed returns a formatted string rather than a numeric value.

TypeScript✓ Tested