c# - How to find out the duplicate characters in a string? -
this question has answer here:
i take string integer count
int count=0; string s="wow"
and using foreach loop count number of characters in specified string
foreach(char ch in s) { count++ }
so how can count characters repeated in string 'w'.
try )
string test = "aababc"; var result = test.groupby(c => c).where(c => c.count() > 1).select(c => new { charname = c.key, charcount = c.count()});
Comments
Post a Comment