Line Counter

Counting the number of lines.




Number of Lines - 0

How This Converter Works

Counts lines split by CRLF, CR, or LF. Empty input is specially reported as zero; a trailing line break creates a final counted empty line.

Formula or rule

For non-empty input, line count = input.split(/\r\n|\r|\n/).length.

Example

Input
red\nblue
Calculation
The LF separates the input into two segments.
Result
2