When using
logic version CSPro 8.0+, newline characters are introduced into
string literals when using the escape sequence
'\n'. This character is handled throughout CSPro as one would generally expect; for example:
- When displaying error messages that contain text with newline characters, the message will be displayed, or written to a listing file, on multiple lines.
- When processing fills in question text or HTML templated reports, newline characters are converted to <br> line break elements.
- When a user enters text on multiple lines using a text box field or in a note, the newline will be stored in the item or note as a '\n' character.
For historical reasons, some text editors represent newlines as a combination of a carriage return and a line feed character: "\r\n". CSPro does not use "\r" characters, so the length of the string "A<line break>B" is 3, not 4.
In certain circumstances, when multiline text is not permissible, newline characters are either removed, converted to a space character,
' ', or converted to the
Unicode symbol for a newline,
''.
Newlines are removed when:
Newlines are converted to spaces (' ') when:
- Calling prompt, not using the multiline feature, with an initial value containing newlines.
- Calling userbar to add text for buttons, fields, and text (on Windows only).
- Displaying item values in CSEntry's case tree.
- When displaying an item's value in a single line text box field.
Newlines are converted to newline symbols ('') when:
When using the Original
logic version, escape sequences cannot generally be used, but in a few cases, newlines are processed:
- When displaying messages with errmsg, "\n" is treated as a newline character.
- When processing the title and choices for the accept function, "\n" is treated as a newline character.
- When handling the title and initial value for the prompt function, "\n" is treated as a newline character and "\\" is treated as a backslash character.
- When adding or editing a note, "\n" is treated as a newline character and "\\" is treated as a backslash character.