countLines Summary Counts the number of lines in the string (including empty lines). Usage public int countLines() Returns The number of lines in the string (including empty lines). Description Counts the number of lines in the string (including empty lines). Please note that this method's return value will overflow and wrap if it exceeds System.Integer32.MAX_VALUE. Examples Basic Usage 12345678910import System; string story = """ The quick brown fox jumped over the lazy dog. """; Console.log(story.countLines()); // 3 Share HTML | BBCode | Direct Link