NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Char to hex or hex to char conversion in TestStand

How can I use the expressions browser in TestStand to make a character to hex or hex to character conversion?  I'm using TestStand 3.0
 
Tony
0 Kudos
Message 1 of 5
(14,069 Views)

I'm not completely sure what you are looking for but:

To convert a character to a hex string representing its ascii value:

Str(Asc("a"), "%x")

---> "61"

To convert a hex string representing an ascii value to a character:

Chr(Val("0x" + "61"))     // note that the 0x prefix is needed if the hex string doesn't already have it
 
---> "a"
 
 
Message 2 of 5
(14,063 Views)

Hi,

is it possible to convert long char to  hex  in TestStand? For example how to convert string "System" to hex. Expression Asc() allow only converts first char in string.

 

Thanks for help

Kate

0 Kudos
Message 3 of 5
(10,705 Views)

What exactly are you trying to do? TestStand does not store strings as unicode, it use multi-byte encoding instead. Perhaps there is a better way to accomplish what you are trying to do.

 

-Doug

0 Kudos
Message 4 of 5
(10,675 Views)

If you are using TestStand 2010, you can use the .NET adapter to use the System.String .NET API directly with TestStand strings. To do so select mscorlib from the GAC assembly list and select System.String as the class. If you select <Use Existing Object> as the first call, you can specify a TestStand string variable for the object.

 

Hope this helps,

-Doug

0 Kudos
Message 5 of 5
(10,672 Views)