counting lines by splitting by, replacing, or looking for line breaks (version: 1)
Compares splitting a string and counting the array items to replacing line breaks with an empty string and computing the difference from the original length.
Comparing performance of: split vs replace vs look