ambiguous question, if you are talking about strings. you need to isolate the number string using a split method, then use double.parse(string) to get the number data. and then do the arithmetic operations.
Yes string value. i am getting this data with Regex. We are already doing the double parse part. transaction is in progress. But it is not falling cumulatively. is adding
could you please share a short code snippet. otherwise it is very difficult to understand the problem.
foreach (string record in data)
{
if (rgx.IsMatch(record))
{
foreach (Match m in rgx.Matches(record))
{
if (m.Groups[1].ToString() != "")
{
sum1 += double.Parse(m.Groups[1].ToString());
}
else
{
//toplam20lik += double.Parse(m.Groups[2].ToString());
}
}
}
else
{
MessageBox.Show("{0} desene uymayan veri", record);
}
}
If your application has to deal with numerical values that come in as text strings, or mixed with non-numerical text string, it is really, really bad programming practice to mix numerical value calculation with text string manipulating/parsing together, whether you use Regular Expression or not.
See the Regex in this reply.