c# - counting occurrences of end of line -


i have string text, want count occurrences of environment.newline.

i thought in way

mystring.where(c => c == environment.newline).count(); 

but c 1 char not work .

any better suggestions ?

with regex:

int count = regex.matches(input, environment.newline).count; 

with string.split:

int count = input.split(new string[] { environment.newline },                       stringsplitoptions.none).length - 1; 

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -