Results for “conversion”
Small, practical examples. Search by task or narrow things down below.
Convert text without raising a conversion error
Return NULL when a numeric conversion fails.
TRY_CONVERT✓ Tested
Handle a failed conversion
Handle a failed conversion using a complete Go program with explicit sample inputs.
Go✓ Tested
Handle a failed string-to-integer conversion
C++: stoi throws invalid_argument when no conversion can be performed.
C++✓ Tested
Inspect a typed conversion error
Inspect a typed conversion error using a complete Go program with explicit sample inputs.
Go✓ Tested
Keep numeric input text until conversion
Keep numeric input text until conversion with a small React component and explicit browser behavior.
React✓ Tested
Reject a narrowing integer conversion
Reject a narrowing integer conversion in a complete Rust program using the standard library.
Rust✓ 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
Convert Celsius to Fahrenheit
Arduino / C: Use floating-point constants to avoid integer division.
Arduino / C✓ Tested
Catch a T-SQL error
Handle an expected conversion error in TRY/CATCH.
TRY CATCH✓ Tested
Convert an aware datetime to another offset
Python: Use astimezone for conversion; replacing tzinfo alone does not convert an instant.
Python✓ Tested
Convert hexadecimal text to bytes
Python: Use bytes.fromhex for a readable byte representation and hex for the reverse conversion.
Python✓ Tested
Detect NaN without converting the input
JavaScript: Number.isNaN tests the special numeric value instead of applying string-to-number conversion.
JavaScript✓ Tested