Such a trivial problem - I simply want to add a CR/LF pair to the end (or middle) of a string.

(Uh, CR/LF means Carriage Return/Linefeed.)

The codes for this are

 HexDecimal Visual Basic Delphi C++ Builder Java Paradox
CR0D13 vbCR #13 \r    
LF0A10 vbLF #10      
CR/LF0D0A13,10 vbCRLF
#13#10 \n newLine() \n
Tab099 vbTab #9 \t    

Well, there is more - the line termination character sequence is operating system dependent. The C \n, the VisualBasic vbNewLine, and the Java newLine() will be interpreted according to the following table.

Operating EnvironmentSequence

As a result, moving "straight text" files between systems can cause pretty severe problems. (In windows, DOS Edit and WinWord convert unix line terminators to DOS line terminators, but notepad just shows the unix teminators as boxes.)

Visual Basic | Delphi | C++ Builder | Java | Others

Visual Basic 6.0

Careful: VB constants are version dependent!
    VisualBasic  3.0          VisualBasic  6.0
  ESC$ = Chr$(KEY_ESCAPE)   ESC$ = Chr$(vbKeyEscape)
   cr$ = Chr$(KEY_RETURN)    cr$ = Chr$(vbKeyReturn)
GlobalConstants.bas is a fully functional and tested module which defines the global variables MS Access 97 and VBA (Visual Basic for Applications) allows vbCR, vbLF, vbCRLF. However, it is not clear if VB supports these.

I'm not sure which versions of VisualBasic and VBA support vbNewLine - it is supported in ASP VBScript.

Delphi 5.0

Use the pound sign (#) to denote a "control String", ie, a single ASCII character.

From ibutils.pas

From Character String help

You can also specify characters using hex

C++ Builder

Use \n to produce a new line (a cr/lf pair on ms dos/windows systems, a single character on unix sustems).


\n is not reliable in Java. Sometimes it produces a new line, othertimes you get a verticle bar. Thus, this is interpreter dependent. Instead, Sun provides the following advice.
A newLine() method is provided, which uses the platform's own notion of line separator as defined by the system property line.separator. Not all platforms use the newline character ('\n') to terminate lines. Calling this method to terminate each output line is therefore preferred to writing a newline character directly.
On the other hand, in its Dialog Box Tutorial, Sun says
You can split the message over several lines by putting newline (\n) characters inside the message string. For example:
Who knows what to believe. I've seen \n fail in text fields.


MS Access 97 allows vbCR, vbLF, vbCRLF

Author: Robert Clemenzi -
URL: http:// / user / clemenzi / technical / Languages / CR_LF.htm