Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ArrayMaker
- {
- public string rawStr { get; set; }
- public Dictionary<string,string> Dict;
- private string pKey = @"\w+=";
- private string pValue = @"=(.*?)(\s)";
- public ArrayMaker(string input)
- {
- rawStr = input;
- }
- public void FillDict()
- {
- Dict = new Dictionary<string,string>();
- string sKey = "";
- string sValue = "";
- string[] splittedSrr = rawStr.Split(new Char[] {','});
- foreach (string s in splittedSrr) {
- Match key = Regex.Match(s, pKey);
- if (!key.Value.Equals("")) { sKey = key.Value.Substring(0, key.Value.Length-1); }
- Match value = Regex.Match(s, pValue);
- if (!value.Value.Equals("")) { sValue = key.Value.Substring(0, key.Value.Length - 1); }
- Dict.Add(sKey,sValue);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement