3
Answers

Adding two numbers in the same string

Ask a question
MystX Jones

MystX Jones

16y
5.5k
1

Hi there

I had this typed out and clicked "post" and all i got was a cleared post screen, so forgive me if i forget something

Basically i need an answer to a string similar to "2+3" or "9+6/3"

The only way i can see to do this in to seperate the two terms and operation, and then "if (Operation == "+") FirstInt + SecondInt" and so on.

Is there a way to make C# run what is contained in the string as a sort of command?

Thanks in advance.


Answers (3)
Next Recommended Forum