Exemplo n.º 1
0
        BrakettCheck BrakettsExistsAndThereNumber(List <string> TheBatch)
        {
            BrakettCheck x = new BrakettCheck();

            x.numberOfEndBrakets   = 0;
            x.numberOfStartBrakets = 0;
            x.exist = (theBatch.Contains("(") || theBatch.Contains("-("));
            if (x.exist)
            {
                foreach (string s in TheBatch)
                {
                    if (s.TrimStart("-".ToCharArray()) == "(")
                    {
                        x.numberOfStartBrakets++;
                    }
                    else if (s == ")")
                    {
                        x.numberOfEndBrakets++;
                    }
                }
            }
            if (x.numberOfEndBrakets != x.numberOfStartBrakets)
            {
                int d = x.numberOfStartBrakets - x.numberOfEndBrakets;
                for (int c = 0; c < d; c++)
                {
                    theBatch.Add(")");
                    x.numberOfEndBrakets++;
                }
            }
            return(x);
        }
Exemplo n.º 2
0
        BrakettCheck BrakettsExistsAndThereNumber()
        {
            BrakettCheck x = new BrakettCheck();

            x.numberOfEndBrakets   = 0;
            x.numberOfStartBrakets = 0;
            x.exist = theBatch.Contains("(");
            if (x.exist)
            {
                foreach (string s in theBatch)
                {
                    if (s == "(")
                    {
                        x.numberOfStartBrakets++;
                    }
                    else if (s == ")")
                    {
                        x.numberOfEndBrakets++;
                    }
                }
            }
            if (x.numberOfEndBrakets != x.numberOfStartBrakets)
            {
                int d = x.numberOfStartBrakets - x.numberOfEndBrakets;
                for (int c = 0; c < d; c++)
                {
                    theBatch.Add(")");
                    x.numberOfEndBrakets++;
                }
            }
            return(x);
        }