Cannot take difference of Strings; looking for Conversion.

Ranorex Spy, Recorder, and Studio.
Kool
Posts: 2
Joined: Fri Oct 30, 2020 8:52 pm

Cannot take difference of Strings; looking for Conversion.

Post by Kool » Fri Oct 30, 2020 8:57 pm

How do I get the difference of two strings that contain numbers, for example

myDefinedVar = myVar1 - myVar2
showbox.bio/
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.
Last edited by Kool on Wed Nov 11, 2020 11:34 am, edited 1 time in total.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6360
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Cannot take difference of Strings; looking for Conversion.

Post by odklizec » Wed Nov 04, 2020 8:23 am

Hi,

In case the numbers in variables are integers, you can use for example Int32.TryParse method.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration