09-19-2014 11:15 AM
Greetings,
I have the need to combine (qty. 2) 1D arrays in TestStand for the first time every. They both will be the same size always. I'd like to build by concatenating.
Array 1 (string): some number1, some number2, some number3
Array 2 (string): string description1, string description2, string description3
Output array: some number1 string description1, some number 2 string description2, some number3 string description3 (so it would be 3 elements total)
Thanks in advance for any help.
Chazzzmd
Solved! Go to Solution.
09-19-2014 12:24 PM - edited 09-19-2014 12:25 PM
Hi,
You can concatenate 2 strings in TestStand by using the "+" operator.
Example:
Locals.Output = Locals.String1 + " " + Locals.String2
In order to concatenate individual string elements in the string arrays, one easy approach would be to use looping structure to iterate over the array and concatenate each of them. Please find below a simple sequence file (I created it in TestStand 2010) that does it using "For Each" looping structure as well as "Looping" property in the step settings. I hope this helps you.
09-22-2014 06:05 AM
Thanks for the reply. I'm assuming the Locals.Output is a 1D array in your example correct?
Yes, I am familiar with triggering off iterations of a loop operation for element [] needs. Unfortunately that's not doable for this operation as the loop is performing a filter operation, meaning the iteration of the loop will not always matchup to the needs of the array. I'll have to do something like............
SetNumElements(Locals.Output,GetNumElements (Locals.Output)+1), Locals.Output[GetNumElements(Locals.Output)-1] =Locals.String1 + " " + Locals.String2
Thanks again for your help. I can't believe I totally skipped over combining strings for my insertion element. Geez
Chazzzmd
09-25-2014 04:00 AM
Glad to be of assistance to you. 🙂