To add to Richard Deemings answer, if I understand correctly, you don't know whether the specified string uses a comma or a dot as the decimal separator. I'm not sure if you work with thousand separators, but you could get 1.000,00 as well as 1,000.00 and both would be valid. This is a huge issue for me as I'm Dutch, where we use a comma as decimal separator, but many computers and keyboards have an international layout.
I use the following code, which basically checks the first instance of a dot or a comma. If a dot is the first one, then the comma is the decimal separator and if the comma is the first one, then the dot is the decimal separator (if one doesn't appear it's -1 and the other is the first one and if neither appear it doesn't really matter anyway).
Richard's code would then be something like (taken from production code):
var value = "1.000,00";
var indexOfDot = value.IndexOf('.');
var indexOfComma = value.IndexOf(',');
var numberFormat = new NumberFormatInfo
{
NumberDecimalSeparator = indexOfComma > indexOfDot ? "," : ".",
NumberGroupSeparator = indexOfComma > indexOfDot ? "." : ","
};
var success = decimal.TryParse(value, NumberStyles.Number, numberFormat, out var parsedValue);
if (success)
{
}
else
{
}