If you want to find newline characters in multi-line strings, you must first set a variable to the character for which you are searching. There are two straightforward ways to do this:
- Set a script variable to the value returned by UC_CRLF().
:SET &CRLF# = UC_CRLF()
- Set object variable to just a newline character.
In my experience, these approaches do not work consistently. I did a quick test to compare the characters being written to these variables.
Script
:SET &CRLF_POS_IN_NL# = STR_FIND(&NEWLINE#,&CRLF#)
:PRINT &&CRLF_POS_IN_NL#: &CRLF_POS_IN_NL#
:SET &NL_POS_IN_CRLF# = STR_FIND(&CRLF#,&NEWLINE#)
:PRINT &&NL_POS_IN_CRLF#: &NL_POS_IN_CRLF#
Results
U00020408 &CRLF_POS_IN_NL#: 0000000000000000
U00020408 &NL_POS_IN_CRLF#: 0000000000000002
From this, I conclude:
- The AE script function UC_CRLF() returns an MS-DOS-style newline: a carriage return and a line feed (CR LF or \r \n).
- In multi-line object variables and other multi-line fields in the Automation Engine, the newline character is a UNIX-style newline: just the line feed character (LF or \n)*.
I also found that when the AE writes a string to a file via an OS agent, it automatically converts newline characters to the style specific to that OS. See the attached JOBS object for an example.
* The newline character used internally by the AE might depend on the OS or database of the AE server.