str_as_int
Converts a string to an integer, returning a default value if the conversion fails.
def str_as_int(
value: str
) - > int
Converts a string representation of a number into an integer. Use this to safely cast numeric strings for arithmetic operations or database indexing.
Parameters
| Name | Type | Description |
|---|---|---|
| value | str | The numeric string to be converted into an integer. |
Returns
| Type | Description |
|---|---|
int | The integer representation of the input string. |