crackyourinterview.com


To improves our performance please Like Share Subscribe(Will boost us)

Subtract two variable which contains character and digit
Question Posted on 11 Apr 2013Home >> DotNet >> C# >> Subtract two variable which contains character and digit

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)
0
0



.


Most Visited Questions:-

Deep Learning Questions Answers
Below are the different Deep Leaning Questions and answer a More...

Continuous Integration Questions Answers
Below are the 20 odd questions for CI or Continuous Integra More...

Derived relationships in Association Rule Mining are represented in the form of __________.
Derived relationships in Association Rule Mining are repres More...

What is Gulpjs and some multiple choice questions on Gulp
Gulpjs is an open source whihc helps in building Javascript More...

Microservices Architecture Questions Answers
Below are the different questions on Microservices Architec More...




Other Important Questions

Simplest definition of partial classes and its rules?

Definition of Tuple class with some examples?

Define Race Condition in cSharp?

C#.Net Reserve Words

can we inherit private class level variables in c#






@2014-2022 Crackyourinterview (All rights reserved)
Privacy Policy - Disclaimer - Sitemap