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: 6520
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

User avatar
DrPsyche
Posts: 6
Joined: Tue Dec 11, 2018 12:27 pm

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

Post by DrPsyche » Wed Apr 07, 2021 12:37 pm

I need to obtain the difference of 2 strings which contain numbers. But an error occurs all the time with my UserCode.cs auto typer essay writer in custom setup changes.
Hello,

Could you please share an example of what each of the values might be? Do the values represent (in your case) longs, integers, doubles?