I am creating an excel document and need a value in a cell to be stored as a string. If it is a number I need to put an apostrophe in front of it. I was using decimal.tryparse but that won't work with a 50 digit number. How can I determine if a string is a number no matter how many characters or digits are there? I also need it to work with a negative sign, commas and a decimal point.
(Please do not ask me to change the way I am creating the excel, that is not important and is not the question.)
decimal out_dec = 0;
//this will always evaluate to false
var isNumber decimal.TryParse("12345678901234567890123456789012345678901234567890", out out_dec)