Results for “Functions & parameter validation”
Small, practical examples. Search by task or narrow things down below.
Implement a method on a struct
Implement a method on a struct in a complete Rust program using the standard library.
Rust✓ Tested
Inspect a substring without allocating a copy
C++: A string_view refers to existing storage and must not outlive that storage.
C++✓ Tested
Inspect a typed conversion error
Inspect a typed conversion error using a complete Go program with explicit sample inputs.
Go✓ Tested
Inspect a value with a type switch
Inspect a value with a type switch using a complete Go program with explicit sample inputs.
Go✓ Tested
Iterate over all regular-expression matches
C++: A regex iterator yields successive matches without manually updating an offset.
C++✓ Tested
Keep caller data unchanged by passing a structure by value
C: A value parameter is a copy of the original structure.
C✓ Tested
Keep numeric input text until conversion
Keep numeric input text until conversion with a small React component and explicit browser behavior.
React✓ Tested
Mutate a struct through a pointer receiver
Mutate a struct through a pointer receiver using a complete Go program with explicit sample inputs.
Go✓ Tested
Normalize canonically equivalent Unicode strings
C#: Normalize to NFC before an ordinal comparison of equivalent character sequences.
C#✓ Tested
Normalize equivalent Unicode strings
Python: Normalize to NFC before comparing canonically equivalent text.
Python✓ Tested
Pad a numeric label to a fixed width
C#: Use a numeric format specifier to add leading zeroes.
C#✓ Tested
Parse a Boolean configuration value
Parse a Boolean configuration value using a complete Go program with explicit sample inputs.
Go✓ Tested