Results for “character”
Small, practical examples. Search by task or narrow things down below.
Split text on several separator characters
TypeScript: A regex character class can recognize alternative simple delimiters.
TypeScript✓ Tested
Take Unicode characters without byte slicing
Take Unicode characters without byte slicing in a complete Rust program using the standard library.
Rust✓ Tested
Find the final path separator
C: strrchr locates the last matching character without modifying the input.
C✓ Tested
Advance an index around a fixed collection
Arduino / C: Modulo wraps a bounded nonnegative index to zero.
Arduino / C✓ Tested
Allocate an independent copy of a C string
C: Include one extra byte for the terminating null character.
C✓ Tested
Apply a linear sensor calibration
Arduino / C: Convert a raw reading using an offset and scale measured for the sensor.
Arduino / C✓ Tested
Assemble a big-endian 16-bit value
Arduino / C: Cast to an unsigned 16-bit type before shifting the high byte.
Arduino / C✓ Tested
Assign a bit from a Boolean state
Arduino / C: bitWrite accepts a bit position and a zero or nonzero value.
Arduino / C✓ Tested
Average a fixed set of readings
Accumulate sample values without overflowing a 16-bit total.
array✓ Tested
Blink the built-in LED three times
Alternate the built-in LED with a short blocking delay.
blink✓ Tested
Blink without blocking the loop
Use elapsed millis time instead of delay for a repeating action.
millis✓ Tested
Branch on a threshold
Arduino / C: Branch on a threshold on an Uno with the Serial Monitor set to 9600 baud.
Arduino / C✓ Tested