From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Fixed number of lines in a string

Solved!
Go to solution

I am trying to have a fixed number of lines in a string control.

Regardless of number of lines  entered in the string control, it should write say 10 lines to a text file.

So it should add blanks if user enters < 10 lines and chop off if number of lines entered are > 10.

 

 

 

 

 

0 Kudos
Message 1 of 2
(2,387 Views)
Solution
Accepted by topic author zezendapuss

Hi zenzendapuss,

 

in your other thread you got several suggestions to get the number of lines in your string. Don't you use any of theses methods?

 

I suggest:

- convert the string into an array of strings using SpreadsheetStringToArray with NL as delimiter

- limit the resulting array to have exactly 10 elements (aka lines), using ArraySubset after appending another 10 elements (containing empty strings)

- convert the array back to your string (or write directly to your file)…

 

Example:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 2
(2,372 Views)