FIND YOUR NEXT FEW LINES

Results for “Strings & byte buffers”

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

195 snippets foundClear filters
Arduino / CText & bounded buffers

Trim surrounding whitespace from an Arduino String

Arduino / C: String.trim modifies the object in place.

Arduino / C✓ Tested
PowerShellStrings & literal text

Trim whitespace around a string

PowerShell: The Trim method removes surrounding whitespace while preserving the middle of the string.

PowerShell✓ Tested
RustStrings & Unicode

Trim whitespace around text

Trim whitespace around text in a complete Rust program using the standard library.

Rust✓ Tested
PowerShellStrings & literal text

Use a literal value in a regular expression

PowerShell: Regex.Escape prevents a literal dot or other metacharacter from changing the match.

PowerShell✓ Tested
PowerShellStrings & literal text

Write a multiline string without expanding variables

PowerShell: A single-quoted here-string preserves dollar signs literally.

PowerShell✓ Tested
CStrings

Measure a string length

Count bytes before the null terminator with C strlen.

C✓ Tested
C++Strings

Reverse a string

Reverse a byte string in place with std::reverse.

C++✓ Tested
CDynamic memory & ownership

Allocate an independent copy of a C string

C: Include one extra byte for the terminating null character.

C✓ Tested
C#Text validation & encoding

Build text incrementally with StringBuilder

C#: Append fragments instead of repeatedly concatenating intermediate strings in a loop.

C#✓ Tested
PowerShellFile operations & integrity

Calculate a file’s SHA-256 digest

PowerShell: Get-FileHash hashes bytes without requiring the caller to load the whole file.

PowerShell✓ Tested
JavaEncoding & structured values

Calculate a SHA-256 content digest

Java: Hash UTF-8 bytes and format the result as lowercase hexadecimal.

Java✓ Tested
Arduino / CBinary values & packets

Calculate a simple packet XOR checksum

Arduino / C: XOR all payload bytes to produce a basic error-detection byte.

Arduino / C✓ Tested