On 5/10/17 3:40 PM, k-five wrote:
I have a line of code that uses "to" function in std.conv for a purpose
like:
int index = to!int( user_apply[ 4 ] ); // string to int
When the user_apply[ 4 ] has value, there is no problem; but when it is
empty: ""
it throws an ConvException exception and I want to avoid this exception.
currently I have to use a dummy catch:
try{
index = to!int( user_apply[ 4 ] );
} catch( ConvException conv_error ){
// nothing
}
I no need to handle that, so is there any way to prevent this exception?
Use the "parse" family: https://dlang.org/phobos/std_conv.html#parse --
Andrei