Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Dictionary<string, int> GetWortAnzahlListe(string rawData)
- {
- string replacedString = Regex.Replace(rawData, "\n", " ");
- replacedString = Regex.Replace(replacedString, "[^a-zA-Z ]", "");
- var list = replacedString.Split(' ').ToList();
- var result = new Dictionary<string, int>();
- while(list.Count > 0)
- {
- string check = list[0];
- int count = list.FindAll(x => x.ToLower() == check.ToLower()).Count;
- list.RemoveAll(x => x.ToLower() == check.ToLower());
- result.Add(check, count);
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement