# Line return, with STRING variable

**URL:** <https://community.br-automation.com/t/line-return-with-string-variable/3558>\
**Category:** Programming\
**Tags:** structured-text\
**Created:** [June 18, 2024, 4:43pm UTC](https://community.br-automation.com/t/line-return-with-string-variable/3558 "2024-06-18T16:43:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![c593065](https://avatars.discourse-cdn.com/v4/letter/c/FF8800/32.png) [@c593065](https://community.br-automation.com/u/c593065)\
**Post date:** [June 18, 2024, 4:43pm UTC](https://community.br-automation.com/t/line-return-with-string-variable/3558/1 "2024-06-18T16:43:38Z")

</div>

Hi,  
Is it possible to return to the line in a STRING or WSTRING type variable, in structured text. I tried a lot of things: \n, $n, |, etc… Nothing seems to work

---

<div class="post-metadata">

**Author:** ![alexander.hefner](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/alexander.hefner/32/111_2.png) [@alexander.hefner](https://community.br-automation.com/u/alexander.hefner)\
**Post date:** [June 18, 2024, 5:03pm UTC](https://community.br-automation.com/t/line-return-with-string-variable/3558/2 "2024-06-18T17:03:12Z")

</div>

Hi,

I’m not sure if I got your question right: do you want to insert a line feed and/or carriage return into a string variable?  
If yes: this is possible, for example in STRING datatype $r is CR and $n is LF.  
More information about STRING literals can be found here:  
[https://help.br-automation.com/#/en/4/programming%2Fprograms%2Fprogrammingmodel\_programs\_literalsiniec.html](https://help.br-automation.com/#/en/4/programming%2Fprograms%2Fprogrammingmodel_programs_literalsiniec.html)

My question is, where should this content be displayed? Because for example in the watch window you won’t get a line feed / carriage return displayed.  
The literals above would work if you store the string data in a file and open the file in a editor, or if you send it for example via a serial or tcp connection to a terminal program.  
If you want to display it in a visualisation, I think then it won’t work (as I remember VC4 has a c based syntax for multiline, in mappView as I know it won’t work because of the HTML interpretation, there you could try to insert the HTML tag for line brake \< br \> into the string, but I’m not sure if that will work).

Best regards!

---

<div class="post-metadata">

**Author:** ![c593065](https://avatars.discourse-cdn.com/v4/letter/c/FF8800/32.png) [@c593065](https://community.br-automation.com/u/c593065)\
**Post date:** [June 19, 2024, 6:57am UTC](https://community.br-automation.com/t/line-return-with-string-variable/3558/3 "2024-06-19T06:57:52Z")

</div>

Hi, !  
Yes it is to display it in an HMI screen. I tried $n and $r but it didn’t work. So this must not be possible. Thank you for your reply. 🙂

---

<div class="post-metadata">

**Author:** ![krausertm](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/krausertm/32/98_2.png) [@krausertm](https://community.br-automation.com/u/krausertm)\
**Post date:** [June 19, 2024, 4:40pm UTC](https://community.br-automation.com/t/line-return-with-string-variable/3558/4 "2024-06-19T16:40:51Z")

</div>

It depends on your HMI if the line feed is actually wrapping the text. Inserting $r$n in Structured Text results in a CRLF. Same thing would obv. be \r\n in ANSIC.

In many HMI systems output fields have a property for wrapping. For a mappView label see e.g. [Label](https://help.br-automation.com/#/de/4/visualization%2Fmappview%2Fwidgets%2Ftext%2Flabel%2Flabel.html) [property: multiLine]

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/e/e75e323097b6c2aeeb56850c4471fefe17abcd76.png)

Best regards,

---

<div class="post-metadata">

**Author:** ![kovarj](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/kovarj/32/537_2.png) [@kovarj](https://community.br-automation.com/u/kovarj)\
**Post date:** [July 26, 2024, 12:17pm UTC](https://community.br-automation.com/t/line-return-with-string-variable/3558/5 "2024-07-26T12:17:27Z")

</div>

Hi , what is the status of your topic? if is it solved, can you marked answer that helps you the most?

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/brcommunity/original/1X/a202d64f0f03e22a662ed33fbbca6879f1efb794.jpeg) [@system](https://community.br-automation.com/u/system)\
**Post date:** [July 28, 2024, 12:47am UTC](https://community.br-automation.com/t/line-return-with-string-variable/3558/6 "2024-07-28T00:47:17Z")

</div>


