Newline character in strings


Recommended Posts

I used a Static Text component as a variable value display for some long strings, can't remember why.  I think it was that I wanted to center justify and line wrap and the variable value display wouldn't do that.

Now I'm using that technique again, but in this case I want to control the line breaks, which I didn't need to in the other application.   Is there a control string that I can embed in the string?  \n and \010 don't work, they just display.  "MyString1" + chr(10) + "MyString2" works, but seems like a control character would be nice if available.

Link to comment
Share on other sites

No, there are no control characters available for that.  Its nice for programmers that are familiar with it, but throws non-programmers which make up a significant part of the DAQFactory user base.

I personally create a variable to hold my CRLF:

global crlf = chr(13) + chr(10)

(or global lf = chr(10) if I need that)

then my concatenation is a little cleaner:

"MyString1" + crlf + "MyString2"

I'll typically split it too:

var = "MyString1" + crlf

var+= "MyString2" + crlf

var+= "MyString3"

Its marginally slower, but you can see the line breaks better in the script.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.