Converting Between Characters and ASCII Values in TestStand

Updated Mar 27, 2023



  • TestStand

I would like to do some ASCII number to character conversions as part of my sequence. Is there a way to do it within TestStand?

For TestStand 3.0 and Later

You can use the asc() and chr() functions for ASCII to character and character to ASCII conversions respectively.

For TestStand 2.0.1

You can use the str() function for ASCII to character conversion by using the format string %c. For example, if you have the ASCII code 97 and you would like to obtain its character representation "a" you could use the following expression:
Locals.newString = Str(97, "%c")
When the expression is evaluated, it will store the string "a" in your Locals.newString variable.

Since the val() function for converting characters to numbers does not accept non-numeric characters, you cannot use it to convert a character back to its ASCII value. To complete character-to-ASCII conversions you will need to use code modules to call external code.