Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string value = "Time= 12.03.2021 Hash=asdfjsldhfsdkljfklsejrfj Ticks=7458734985,545 IP=::1";
- string[] keys = { "Time=", "Hash=", "Ticks=", "IP=" };
- Dictionary<string, string> dict = new();
- List<int> list = new();
- foreach (var key in keys)
- {
- list.Add(value.IndexOf(key));
- }
- list.Add(value.Length);
- for (int i = 0; i < keys.Length; i++)
- {
- dict[keys[i]] = value[(list[i] + keys[i].Length)..(list[i + 1])];
- }
Advertisement
Add Comment
Please, Sign In to add comment