numberOfLines = Streams.countLines(fileName)
Function countLines(..) opens the given file, reads the complete content, closes the file and returns the number of lines. Lines are separated by LF or CR-LF.
impure function countLines
extends Modelica.Icons.Function;
input String fileName "Name of the file that shall be read" annotation(
Dialog(loadSelector(filter = "Text files (*.txt)", caption = "Open text file for counting lines")));
output Integer numberOfLines "Number of lines in file";
end countLines;