Results for “variant”
Small, practical examples. Search by task or narrow things down below.
Apply an operation to a variant’s active value
C++: A generic visitor lets the compiler check behavior for every possible alternative.
C++✓ Tested
Match enum variants
Match enum variants in a complete Rust program using the standard library.
Rust✓ Tested
Read a variant only when it holds the expected type
C++: get_if returns a null pointer rather than throwing for another active alternative.
C++✓ Tested
Select a component variant explicitly
Select a component variant explicitly with a small React component and explicit browser behavior.
React✓ Tested
Store data in an enum variant
Store data in an enum variant in a complete Rust program using the standard library.
Rust✓ Tested
Format a date without locale ambiguity
Parse an ISO date and format it consistently.
date✓ Tested
Format a decimal amount
Use invariant culture to print a C# decimal with two places.
C#✓ Tested
Search text without case sensitivity
Linux Commands: Use grep -i to match uppercase and lowercase variants.
Linux Commands✓ Tested