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: 

split long string to new lines

Solved!
Go to solution

Hi everyone this is what i would like to achieve for my string indicator:

 

25/1/2019
25/1/2019
25/1/2019

 

instead of all the strings being all together(see picture attached)

I have refered and tried https://forums.ni.com/t5/LabVIEW/insert-space-in-string/td-p/2536200 this post but i could not get it.

I also refered tohttp://zone.ni.com/reference/en-XX/help/371361L-01/glang/match_regular_expression/ and changed the "$1" to "\n" for new line but to no avail.. Pls help

0 Kudos
Message 1 of 5
(2,666 Views)

Hi Edmund,

 

what about inserting EOL chars when you want to have linebreaks in the string?

check.png

Best regards,
GerdW


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

Hi GerdW is this what you meant? I still cannot get :

25/1/2019

25/1/2019

 

 

Download All
0 Kudos
Message 3 of 5
(2,646 Views)

@edmund99 wrote:

Hi everyone this is what i would like to achieve for my string indicator:

 


You don't give sufficient information to help you. A string indicator passively displays whatever string data is wired to it, so you simply need to manipulate the string data. You don't show us any code, so we have no idea where the string comes from and how it is built up.

 

The current string has absolutely no delimiters, so it would be better to solve the problem upstream and process it before all that loss of information.

 

If you can only work with the current concatenated string, you need to find a 1 or 2 digit number, a "/", another 1 or 2 digit number, another "/", then 5 or six numbers. In that last group, you need to insert a linefeed character after the first four digits. Then go on to the next group until the end of the string. There are many ways to do that.

 

So please show us how the string is formed. I bet it will be much easier to polish it up much earlier.

0 Kudos
Message 4 of 5
(2,645 Views)
Solution
Accepted by topic author edmund99

@edmund99 wrote:

Hi GerdW is this what you meant? I still cannot get : 


OK, thanks for posting code and data. The code is such a mess that it is difficult to tell what you actually want. Fortunately, the file contains nicely comma delimited fields. Since nothing ever changes after the first iteration, you can probably delete the while loop, right?

 

If you just want the dates, take the "second subarray" and use "array to spreadsheet string" with  %s as format, and line feed as delimiter.

 

linebyline.png

Message 5 of 5
(2,643 Views)