New Line

Prev Next

Overview

Inside B4P, every new line is counted as one character, regardless on which operating system B4P is running on. The character code is ANSI / UNICODE 10 (line feed).

In B4P, the new line can be specified with:

       echo( Hello, new line, World, new line );       // Hello World on 2 rows, plus additional new line
       echo( Hello, chr(10), World, chr(10) );         // New line represented as a character codes
       echo( 'Hello
World&#nl;' );                 // New line represented as a character entities
       echo( 'new line' );                             // This is just text and not a new line symbol
       echo( code( new line ) );                       // Code 10, line feed
       echo( 'Character count: ', new line{} );        // new line contains one character
Hello
World

Hello
World

Hello
World&#nl;
new line
10
Character count: 1
Try it yourself: Open LAN_Features_New_Line.b4p in B4P_Examples.zip. Decompress before use.

Loading and Saving Files

B4P is able to load text files containing both "carriage return + line feed" (CR+LF) characters common in Windows systems and "line feed only" (LF) common in UNIX/LINUX/MACOS systems. When saving contents to files, the new line symbol will be automatically saved as line-feed (LF) in UNIX / Linux / MacOS systems and carriage-return + line-feed (CR+LF) character pairs in Windows systems. The legacy Macintosh "carriage return only" (CR) used as line separator is not supported.