65.9K
CodeProject is changing. Read more.
Home

Counting lines in a string

starIconstarIconstarIconstarIconstarIcon

5.00/5 (7 votes)

Jan 9, 2012

CPOL
viewsIcon

12073

Can't we have something as below?int n=(s.Split(new char[]{'\n'})).Length;where n is the number of lines?

Can't we have something as below?

int n=(s.Split(new char[]{'\n'})).Length;

where n is the number of lines?