LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Editor >> Find and Replace text - can replacement string include a newline character?

Solved!
Go to solution

When using the Find and Replace function within the LabVIEW editor, is it possible to include a newline (line feed) character within the replacement string?

0 Kudos
Message 1 of 12
(4,350 Views)

Have you tried it?  Using a '\n'?

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 12
(4,338 Views)

I can't think of any reason why not.  Did you try it?  Hint: make a test VI with just the Find And Replace function and the inputs you want and see what happens.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 12
(4,318 Views)

Yes, I did try that before I asked the question. The net result was that the two characters, "\" and "n" were inserted instead of a newline character.

0 Kudos
Message 4 of 12
(4,303 Views)

Right-click the string constant and change to " '\' Codes Display " first, then put in "\n".

 

Note that this will change all of your spaces, tabs, etc in that string to \s, \t, and so on.

Message 5 of 12
(4,291 Views)

@Kyle97330 wrote:

Right-click the string constant and change to " '\' Codes Display " first, then put in "\n".

 

Note that this will change all of your spaces, tabs, etc in that string to \s, \t, and so on.


You do realize that this is the text entry box that's being discussed here?

What you suggest does not work.

 

Clipboard01.png

0 Kudos
Message 6 of 12
(4,279 Views)

I think what Kyle is saying is that once you turn on special codes display, the replace will work as you intend.  The search function apparently only looks at what is visible in the control.  If special codes is turned on, it will search and replace just fine.  If they are turned off, it doesn't interpret '\n' as a newline and you will get unintended results.  

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 7 of 12
(4,274 Views)

It would be more trouble to go through the project and turn on (& later turn off) the special codes display in the 100+ places where I want to make the change than it would be to make the change manually after just doing a FIND.

0 Kudos
Message 8 of 12
(4,270 Views)

Agreed but this is potentially do-able via scripting.  Is this a one-time thing or something you forsee having to do frequently?  

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 9 of 12
(4,267 Views)
Solution
Accepted by topic author WNM

One time, I hope. 

I just thought that there might be a simple way to do it that I was missing.

It really sounds like there is not.

 

I can do it manually in less time than it would take to create a script and get it working right.

 

0 Kudos
Message 10 of 12
(4,264 Views)