I want to convert string to integer (i32) and if error I want it to return 0 using function bellow:
fn convertToInteger(a: []const u8) i32 {
return std.fmt.parseInt(i32, a, 10);
}
but it always gives this error:
error: expected type 'i32', found 'error{InvalidCharacter,Overflow}!i32'
return std.fmt.parseInt(i32, a, 10);
~~~~~~~^