LineCount (function)

Syntax

LineCount(text$)

Description

Returns an Integer representing the number of lines in text$.

Comments

Lines are delimited by carriage return, line feed, or both.

Example

This example reads your autoexec.bat file into a variable and then determines how many lines it is comprised of.

Const crlf = Chr$(13) + Chr$(10)

Sub Main()
  file$ = "c:\autoexec.bat"
  Open file$ For Input As #1
  txt = ""
  Do Until Eof(1)
    Line Input #1,lin$
    txt = txt & lin$ & crlf
  Loop
  lines! = LineCount(txt)
  MsgBox "'" & file$ & "' is " & lines! & " lines long!" & crlf_
        & crlf & txt
End Sub

See Also

Item$ (function); ItemCount (function); Line$ (function); Word$ (function); WordCount (function).

More information

L