I have strings of numbers (possibly a vector of strings of numbers) which can be either integer or floating point – I may not know the type in advance – and I want to preserve the type. I understand that I should use function
parse to convert the string to number. One possible (but ugly?) strategy is the following (e.g., with
s = "200"; x = try parse(Int,s) catch parse(Float64,s) end;
Is there a better way to do this? Something like
parse(Number,s), or something?