Results for “Parsing & byte data”
Small, practical examples. Search by task or narrow things down below.
Transpose an optional parsing result
Transpose an optional parsing result in a complete Rust program using the standard library.
Rust✓ Tested
Try parsing an integer
Use TryParse to avoid exceptions for invalid C# integer input.
C#✓ Tested
Validate UTF-8 bytes
Validate UTF-8 bytes using a complete Go program with explicit sample inputs.
Go✓ Tested
Write and read binary bytes
Round-trip a byte buffer through a C binary file.
C✓ Tested
Write and read bytes without text conversion
C++: Use binary stream modes and check each I/O operation before consuming its result.
C++✓ Tested
Write and read raw bytes
C#: Use the byte-oriented file APIs when no text encoding should be applied.
C#✓ Tested
Write formatted text into a byte buffer
Write formatted text into a byte buffer in a complete Rust program using the standard library.
Rust✓ Tested
Convert ASCII text to lowercase safely
C++: Cast each byte to unsigned char before using the cctype function.
C++✓ Tested
Decode a 16-bit big-endian integer
C: Promote bytes to an unsigned integer type before combining shifted values.
C✓ Tested
Pack and unpack a network-order integer
Python: Use an explicit byte order so the binary format is independent of the host architecture.
Python✓ Tested
Serialize a 16-bit integer in big-endian order
C: Explicit shifts make a byte format independent of the CPU’s native byte order.
C✓ Tested
Trim surrounding ASCII whitespace
C++: Find the first and last non-whitespace bytes before taking a substring.
C++✓ Tested