LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Striping lines from strings

Hello,

I am trying to remove a line from a string array. I know that it
is the second line, I don't know the length of the first line.
Here is a sample input:

numel numnp nmat nmode
1 8 1 0
matl no., E modulus, Poisson Ratio, mass
0 3000000.0 0.29 2.77e3
el no.,connectivity, matl no
0 0 1 2 3 4 5 6 7 0


I would like Labview to extract the second line; 1 8 1 0

Thanks,
Richard
0 Kudos
Message 1 of 4
(3,494 Views)
Is it a string array or a multi-line string?
If it's an array, you can use the Index Array function from the Array palette. If it's a multi-line string, you can use Pick Line from the String >> Additional String Functions palette. Either way, you give it a zero based index, so index = 1 will return the second line. If using Pick Line, leave the string input unwired and wire the multi-line string to the multi-line string input.
0 Kudos
Message 2 of 4
(3,494 Views)
The trick is to strip off the first line by looking for the line terminator(s). The Match Pattern function from the String palette can accomplish this task by using the search string:

[/r/n]+

That string will match any number or combination of carriage returns and linefeeds, which will effectively strip off the first line.

If you would like to see an example of how it works, let me know and I'll post one...

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 4
(3,494 Views)
Using the Pick Line function, you don't have to explicitly search for the line terminator: you just tell it which line (by zero-based index) you want. Pick Line is in the String >> Additional String Functions palette.
0 Kudos
Message 4 of 4
(3,494 Views)