How to Find Index of Character if our string contain duplicate Character

How to Find Index of Character if our string contain duplicate Character
Ex:String Saaannndhya

How to Find index of ecah a,and each n

Hey!

Have a view on this thread

Regards,
NaNi

I need index of duplicate character

not count of duplicate character

Hi @Sandhya_Gajare

Try this approach

image

Str.Distinct.Where(Function(x) Str.Count(Function(y) y.Equals(x)) >1).ToDictionary(Function(k) k.ToString, Function(v) Regex.Matches(Str, v).Cast(Of Match).Select(Function(x) x.Index).toArray)

image

xaml for reference

IndexOfDuplicateCharacters.xaml (5.1 KB)

1 Like