07-03-2019 09:23 AM
I'm working on a program that requires a certain sequence of outputting from a string. In python, I am able to use this line to select the last 2 elements of the string to be added to the first 2 elements of the string to form the output
sl=str(z1)
sll=sl[-2:]+sl[:2]
Any idea how to replicate this in teststand.
Locals.hextstr=Str(Locals.y1,"%x"), Locals.hextstr2=Str(Locals.y2,"%x"),Locals.s=Locals.hextstr+Locals.hextstr2
I need to get the last 2 elements from hexstr and then to be followed by the first 2 elements of hexstr and repeat this for hexstr2 also
Solved! Go to Solution.
07-03-2019 01:20 PM
TestStand has two functions, Left() and Right(), that you can use to extract some characters from the beginning and end of a string.
Let's say you have Locals.String = "12abcdef34"
and that you display the following code in a message popup: Left(Locals.String,2) + Right(Locals.String,2)
you would get: 1234
07-03-2019 01:21 PM - edited 07-03-2019 01:23 PM
Use left() and right() string functions.
Have you looked at available functions for teststand expressions? The expression browser list all available functions.
07-08-2019 09:51 AM
Thank you. That was very helpful