| To subtract two number which contains character value and we need to subtract digit in these two variables. Here we will take two textboxes first contains value 12a and second contains 7a. To subtract this we take regex. Below is the example
// first we need to get value of two textbox in variables
string firststr=TextBox1.Text;
string secondstr=TextBox2.Text;
//convert two values into integer and remove character from it
int firstint=Convert.ToInt32(Regex.Replace(firststr, "[^0-9]", ""));
int secondint = Convert.ToInt32(Regex.Replace(secondint, "[^0-9]", ""));
//Now result is displayed
Response.Write(firstint-secondint)
| | |