extractIntFromString function
Extracts the first integer found in a string.
Returns 0 if no integer is found in the input string.
final result = extractIntFromString('Order number: 12345');
print(result); // 12345
@ai Use this method to extract integers from formatted strings.
Implementation
int extractIntFromString(final String input) =>
int.tryParse(RegExp(r'\d+').firstMatch(input)?.group(0) ?? '') ?? 0;