How do I get the difference of two strings that contain numbers, for example
myDefinedVar = myVar1 - myVar2
is there a convert to number function. I believe when Ranorex variables are defined they are setup as strings. I did get an error stating cannot subtract strings with my UserCode.cs chnages.
Cannot take difference of Strings; looking for Conversion.
Re: Cannot take difference of Strings; looking for Conversion.
You need to convert them to whatever type of number they are supposed to be, as you have guessed.
Do your values represent integers, longs, doubles, etc.? Can you give an example of what each value might be?
If you are using integers, then you need to use the Parse() method of the "int" class.
Do your values represent integers, longs, doubles, etc.? Can you give an example of what each value might be?
If you are using integers, then you need to use the Parse() method of the "int" class.
Code: Select all
int myValue1 = int.Parse(myVar1);
int myValue2 = int.Parse(myVar2);
int myDefinedVar = myValue1 - myValue2;
Shortcuts usually aren't...