Exemple #1
0
        public static bool TryParse(string s, out SearchTokenList result)
        {
            SearchTokenList temp = new SearchTokenList();

            result = null;
            if (s.Length == 0)
            {
                // empty
                result = temp;
                return(true);
            }
            if (!s.StartsWith("?"))
            {
                // doesn't start with ?
                return(false);
            }
            string[] split = s.Substring(1).Split("&");
            for (int i = 0; i < split.Length; i++)
            {
                string   queryToken      = split[i];
                string[] queryTokenSplit = queryToken.Split("=");
                if (queryTokenSplit.Length != 2)
                {
                    // invalid query token
                    return(false);
                }
                temp.Set(queryTokenSplit[0], queryTokenSplit[1]);
            }
            result = temp;
            return(true);
        }
Exemple #2
0
        public SearchTokenList(string search)
        {
            SearchTokenList result = Parse(search);

            Tokens = result.Tokens;
        }