From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can you convert the elements of a string into an array

I am trying to take three strings and manipulate them into one string to send to a printer.

123
456
789

must be sent as 147258369. Is there anyway of doing this?
0 Kudos
Message 1 of 3
(2,521 Views)
Yes, use the string to byte array function to get ascii numeric representations of each character. Its located under the comparision palette of the numeric palette. If you need a string array use a while or for loop to strip off each character of the string and pass it out, the loop edge will automatically build an array. For stripping each character use string subset, search/split string or match pattern all located in the string palette.

Jared
Message 2 of 3
(2,521 Views)
The easiest way is to get the first character of each string and concatenate those together, then get the next character in each string and add them to the end of the string you just made. Do this until you get to the end. This can be done in a for loop. See the attached vi for an example.

Brian
Message 3 of 3
(2,521 Views)