Results for “Encoding & structured values”
Small, practical examples. Search by task or narrow things down below.
Print a floating-point value with fixed precision
Choose the number of decimal places in serial output.
float✓ Tested
Read a JSON file
Load a JSON document from disk into Python objects using an explicitly selected text encoding.
json✓ Tested
Read checked options
Collect checked checkbox values with jQuery map and get.
jQuery✓ Tested
Read compressed text directly
Python: Open gzip data in text mode with an explicit encoding.
Python✓ Tested
Read rows from CSV text
Parse CSV into objects with named properties.
CSV✓ Tested
Reject infinity and NaN
C#: Double.IsFinite distinguishes usable finite numeric inputs from special values.
C#✓ Tested
Reject one outlier with a median-of-three filter
Arduino / C: Sorting three values leaves the median in the middle.
Arduino / C✓ Tested
Remove an indexed element and compact the array
Bash Scripts: Unsetting an element leaves a gap; reassigning the values creates consecutive indices.
Bash Scripts✓ Tested
Remove duplicates from a list
Remove repeated hashable values while preserving the order in which they first appeared.
list✓ Tested
Represent a decimal quantity with a scaled integer
Arduino / C: Integer hundredths avoid floating-point storage for fixed-precision values.
Arduino / C✓ Tested
Represent a small set of named states
C: An enum gives symbolic names to integer state values.
C✓ Tested
Restore controls to their initial form defaults
HTML: A reset button restores default values rather than clearing every control.
HTML✓ Tested