LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert a string array 2d into a string

Solved!
Go to solution

 Good afternoon. I need to convert a string array 2d into a string separating as per the image in the attachment. Can anybody help me?

 

String 2DString 2DString that I needString that I need

0 Kudos
Message 1 of 8
(3,586 Views)
Solution
Accepted by topic author rafael.assis16

This might work. (FOR loop, index array concatenate string, array to spreadsheet string, trim whitespace)

 

ArrayToString.png

Message 2 of 8
(3,582 Views)
Solution
Accepted by topic author rafael.assis16

Without loops

snip.png

 Snap13.png

 

 

 

 

FYI CA's solution is probably faster, did not check, but it always is. 🙂

 

mcduff

Message 3 of 8
(3,575 Views)

Simple solution, I was trying to do something but did not think that way.

0 Kudos
Message 4 of 8
(3,574 Views)
Solution
Accepted by topic author rafael.assis16

One more R-G way.

 

snip.png

Message 5 of 8
(3,569 Views)

Be very careful with the other solutions presented. Some might blow up if e.g. one of the elements in the original string contains spaces, linefeeds, etc.). My solution retains all strings verbatim and is thus probably safer.

0 Kudos
Message 6 of 8
(3,549 Views)

@mcduff wrote:

Without loops

snip.png

 Snap13.png

 

 

 

 

FYI CA's solution is probably faster, did not check, but it always is. 🙂

 

mcduff


Without user defined loops. Under the hood those primitives are still looping.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 7 of 8
(3,544 Views)

Last solution had a bug, should be string length minus 3 NOT 3 minus string length

 

Some might blow up if e.g. one of the elements in the original string contains spaces, linefeeds, etc.).

 

Spaces should be okay, carriage returns okay, linefeeds okay, BUT the carriage return line feed combo (\r\n) if contained in the original string then you will have some problems.

 

mcduff

0 Kudos
Message 8 of 8
(3,526 Views)