My scenario is : The bot needs to read all the letters in a word and return the number of times each letter appears in the word. e.g., If the word is Alankrita singh. The output should be A - 3, L - 1, N - 2, K - 1, R -1, I - 2, T - 1, S - 1, G - 1, H - 1. The code should be dynamic. It should be able to perform this operation on any word. Please suggest how can i do this ?
yes. this is working. Can you explain me the function that you have use. How it is working in this case?
Can you explain me the function that you have use. How it is working in this case?
yourString.Distinct() returns list of non-duplicated items. in this case it’s
Next, ToDictionary method returns dictionary which has the following key and value.
Function(c) c returns each item of the above list, like
yourString.Count(Function(s) s=c) returns count of characters which match each item and characters of yourString variable, like
Count "A" in "ABCDABCA" ,
Count "B" in "ABCDABCA" …
Thank you for explaining. Are all these .net functions?
Yes. They are .net methods.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.