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# - SharpSVN - How to get the previous revision? -

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

url - Querystring manipulation of email Address in PHP -