I have a string mystring that the user enters. I check that it is a valid decimal thus
decimal val;
bool validDecimal = decimal.TryParse(mystring, out val);
if (!validDecimal)
isvalid = false;
But this is not the only validation I need to do. I also need to check that this decimal is specified to 2 decimal places or less
so,
23, 23.1, 23.45
are all valid
but
23.345, 23.450
are not.
What’s the best way to do this?
How about string parsing.