c# count number of occurrences in string

124

c# count number of occurrences in string -

char myChar = 'x';
string myString = "xyz";

int count = myString.Count(s => s == myChar);

Comments

Submit
0 Comments