Advertisement
bullit3189

MemoryView-StringAndRegex

Mar 16th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. namespace _02MemoryView
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. string result = string.Empty;
  12. List<string> words = new List<string>();
  13.  
  14. while (true)
  15. {
  16. string input = Console.ReadLine();
  17.  
  18. if (input == "Visual Studio crash")
  19. {
  20. break;
  21. }
  22.  
  23. result += input + " ";
  24. }
  25.  
  26. string[] tokens = result.Split();
  27.  
  28. for (int i = 0; i < tokens.Length-5; i++)
  29. {
  30. if (tokens[i]=="32656" && tokens[i+1] == "19759" && tokens[i+2] == "32763" && tokens[i+3]=="0" && tokens[i+5]=="0")
  31. {
  32. string word = string.Empty;
  33. int len = int.Parse(tokens[i + 4]);
  34.  
  35. for (int j = i+6; j < i+6+len; j++)
  36. {
  37. string curr = tokens[j];
  38. int currAsNum = int.Parse(curr);
  39. word += (char)currAsNum;
  40. }
  41.  
  42. words.Add(word);
  43. }
  44. }
  45.  
  46. Console.WriteLine(string.Join(Environment.NewLine,words));
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement