Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. public static Dictionary<string, int> GetWortAnzahlListe(string rawData)
  2. {
  3. string replacedString = Regex.Replace(rawData, "\n", " ");
  4. replacedString = Regex.Replace(replacedString, "[^a-zA-Z ]", "");
  5.  
  6. var list = replacedString.Split(' ').ToList();
  7. var result = new Dictionary<string, int>();
  8.  
  9. while(list.Count > 0)
  10. {
  11. string check = list[0];
  12.  
  13. int count = list.FindAll(x => x.ToLower() == check.ToLower()).Count;
  14. list.RemoveAll(x => x.ToLower() == check.ToLower());
  15.  
  16. result.Add(check, count);
  17. }
  18.  
  19. return result;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement