08-06-2014 10:17 AM
Hi everyone, I think this is a fairly easy question to answer but I am newer to TestStand.
In one step I am pulling in the Serial Number of a Device (which is alpha and numeric characters) and storing it as a String Local called Local.SerialNumberString. In the following step I need to convert this Local to a Hex value and store it as Locals.SerialNumberHex
Here is the data representation I need to take place:
Locals.SerialNumberString = ABC123456
and would like to know of a function that would convert to the following:
Locals.SerialNumberHex = 414243313233343536
How can this be done?
Thanks so much!
08-06-2014 11:47 AM
It looks like what you are asking for is more than just converting to hex, it looks like you want to convert the characters in the string to their ascii value representation and then convert that to hex.
1) Use a for loop Locals.i = 0; Locals.i < Len(Locals.SerialNumberString); Locals.i++
2) Inside the loop do: Locals.SerialNumberHex += Str(Asc(Mid(Locals.SerialNumberString, Locals.i, 1)), "%.2x")
Hope this helps,
-Doug