• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
      • Introduction to CSPro Language
      • CSPro Program Structure
      • Programming Standards
      • Change Code Properties
      • Code Folding
      • Debugging CSPro Applications
      • Declaration Section
      • Procedural Sections
      • Logic
      • Language Elements
        • Version
        • Delimiters
        • Comments
        • Preprocessor
        • Variables and Constants
          • Data Items
          • This Item ($)
          • Subscripts
          • Numbers
          • Boolean Values
          • Special Values
          • Refused Value
          • String Literals
          • Newline Handling
        • Expressions
        • Operators
        • Files
        • Miscellaneous
      • JavaScript Use in CSPro
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
    • Text Templates
    • Templated Reporting System
    • HTML, Markdown, and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataManager>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Newline Handling

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 HTML or Markdown question text or 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.
Single Line Newline Handling
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:
  • Item data is written to a Semicolon Delimited data source.
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:
  • Item data is written to a Text data source. The '␤' character is also used for the text notes and text status files.
  • Item data is written using the export statement.
  • Used as a PFF property value.
  • Writing case keys to a text listing file.
  • Displaying case keys and labels in Data Manager.
  • Displaying case keys and labels in CSEntry's case listing (on Windows only).
Newlines Using Logic Version: Original
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.
See also: Logic Version, String Literals