(Uh, CR/LF means Carriage Return/Linefeed.)
The codes for this are
|Hex||Decimal||Visual Basic||Delphi||C++ Builder||Java||Paradox|
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.
|MS DOS/MS Windows||CRLF|
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 6.0
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
esc$, cr$, lf$, crlf$
tempStr$ = "Line 1" & crlf$ & "Line 2"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.
Use the pound sign (#) to denote a "control String", ie, a single ASCII character.
const CRLF = #13 + #10; CR = #13; LF = #10; TAB = #9; NULL_TERMINATOR = #0;From Character String help
tempStr := 'Line 1'#13#10'Line 2';
You can also specify characters using hex
const CRLF = #$D#$A; CR = #$D; LF = #$A;
Use \n to produce a new line (a cr/lf pair on ms dos/windows systems, a single character on unix sustems).
tempStr = "Line 1\nLine 2";
\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.
JavaA 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. sun.comOn the other hand, in its Dialog Box Tutorial, Sun saysYou 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."Complete the sentence:\n \"Green eggs and...\""
MS Access 97 allows vbCR, vbLF, vbCRLF
Author: Robert Clemenzi - email@example.com
URL: http:// cpcug.org / user / clemenzi / technical / Languages / CR_LF.htm