Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get count of '#' in a string? [duplicate]

Tags:

c#

.net

Possible Duplicate:
How would you count occurences of a string within a string (C#)?

how do I get the count of the occurrences of '#' in a string ?

something like int RowFormat = drr[3].ToString("#").Length;

example string "grtkj####mfr "

RowFormat must return 4

and yes ^_^ .NET 3.5

like image 858
cnd Avatar asked Mar 16 '10 13:03

cnd


1 Answers

int RowFormat = "grtkj####mfr".Count(ch => ch == '#');
like image 161
Kamarey Avatar answered Sep 28 '22 09:09

Kamarey