FIND YOUR NEXT FEW LINES

Results for “TRY_CONVERT”

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

247 snippets foundClear filters
PythonFunctions & error handling

Parse a typed command-line option

Python: Use argparse to validate and convert an integer option.

Python✓ Tested
C#Types & reliable control flow

Parse an enum name without throwing

C#: Combine TryParse and IsDefined when only named declared values should be accepted.

C#✓ Tested
PythonStrings & dates

Parse and format a date

Convert a date string into a datetime object, then format it in a different, human-readable order.

date✓ Tested
ReactComponents & props

Pass an input ref as a React 19 prop

Pass an input ref as a React 19 prop with a small React component and explicit browser behavior.

React✓ Tested
ReactGetting Started

Pass an object to the style prop

Pass an object to the style prop with a small React component and explicit browser behavior.

React✓ Tested
ReactGetting Started

Pass data through props

Pass data through props with a small React component and explicit browser behavior.

React✓ Tested
Bash ScriptsProcesses & environment

Preserve a failure status while an EXIT trap runs

Bash Scripts: Capture the status immediately on entry to the trap before running cleanup commands.

Bash Scripts✓ Tested
ReactLists & filtering

Preserve item state while reordering by key

Preserve item state while reordering by key with a small React component and explicit browser behavior.

React✓ Tested
ReactContext & shared state

Provide read-only application configuration

Provide read-only application configuration with a small React component and explicit browser behavior.

React✓ Tested
ReactAccessibility & events

Read a data attribute from the current target

Read a data attribute from the current target with a small React component and explicit browser behavior.

React✓ Tested
PowerShellStructured formats & encodings

Read a tab-separated table

PowerShell: ConvertFrom-Csv accepts an explicit delimiter instead of requiring comma-separated input.

PowerShell✓ Tested
ReactContext & shared state

Read a value from context

Read a value from context with a small React component and explicit browser behavior.

React✓ Tested