How to display count of individual letter in a string?

Hi, I have a string “Ruchita Patil”
How can I get the following output in uipath studio in a message box?

Input: String = “Ruchita ruchi Patil”
Output: R = 2
u = 2
c = 3
h = 2
i = 3
t = 2
a = 2
P = 1
l = 1

Thanks!!

Hi,

Can you try the following sample?

dict = yourString.GroupBy(Function(c) c.ToString.ToUpper).ToDictionary(Function(g) g.Key,Function(g) g.Count)

Sequence.xaml (6.7 KB)

Regards,

1 Like

Hi, thank you so much for the help!!
Also, could you please tell me what code language is that and where can I learn it?

Hi,

It’s LINQ (for VB). The following topic will help you.

And we can also write it without LINQ as the following.

Hope this helps you.

Regards,