NI Home > Community > NI Discussion Forums

LabVIEW

Reply
Member m-s
Member
m-s
Posts: 159
0 Kudos
Accepted Solution

Converting a delimited string to a string array

I have a string:

(no quotes)

 

"Aout,B,Cin,D,Etest".

 

I want to convert this into a 1D array of 

 

Aout

B

Cin

D

Etest

 

I could not find a VI that does that. Best way to do this ?

Trusted Enthusiast
TCPlomp
Posts: 3,097
0 Kudos

Re: Converting a delimited string to a string array

The string to array function will do that.

 

Use a comma as the delimimter and a 1d-array as the data-type.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Member m-s
Member
m-s
Posts: 159
0 Kudos

Re: Converting a delimited string to a string array

Thanks for the quick response.

 

I tried using the Spreadsheet string to array function, with the comma as the delimiter and %s as the format (as the documentation says). The input numeric double array (2D) is unwired. However, the output is still a double (orange) and wiring it to the search 1D array VI expecting a string array input produces a bad wire.

 

Am I using the wrong VI ?

Knight of NI
Dennis_Knutson
Posts: 33,042
0 Kudos

Re: Converting a delimited string to a string array

Simply wire an empty 1D string array to the 'array type input'.

Member m-s
Member
m-s
Posts: 159
0 Kudos

Re: Converting a delimited string to a string array

Had to wire a constant string array to the array type. Works now.

 

Thanks.

Knight of NI
RavensFan
Posts: 15,608
0 Kudos

Re: Converting a delimited string to a string array

Then please mark Dennis' message as the solution to your question instead of your own message since he was the one who gave you the solution.

 

You can unmark yours by going to the option menu to the upper right of your message.