Increment a hexadecimal string in TestStand

Updated Apr 14, 2018

Reported In

Software

  • TestStand

Issue Details

  • I have a hexadecimal number represented as a string in TestStand. I would like to increment that number and then output it again as a hex string. How can I do this?
  • I have a hexadecimal number represented as a string and would like to do mathematical functions using this number. How can I do this?

Solution

Converting from a hexadecimal string to a number and vice-versa can be done using the built-in TestStand Functions.

The following code could be used to convert a hex string to a number, increment that number and then convert it back to a hex string:
 

locals.Num = Val("0x" + locals.String), locals.Num ++, locals.String=Str(locals.Num, "%x")

The increment portion of the code (Locals.Num ++) could be replaced with any mathematical function that needed to be performed on the value.

WAS THIS ARTICLE HELPFUL?

Not Helpful