Example #1
0
        public static CoordAB Parse(string str)
        {
            CoordAB first = new CoordAB();


            int  tmp   = 0;
            int  count = 1;
            int  i     = 0;
            bool min   = false;

            for (; i < str.Length; i++)
            {
                if (str[i] > '0' && str[i] < '9' || str[i] == '-')
                {
                    if (str[i] != '-')
                    {
                        tmp    = (str[i] - '0') + tmp * count;
                        count *= 10;
                        if (i + 1 < str.Length && (str[i + 1] < '0' || str[i + 1] > '9'))
                        {
                            first.TheA = tmp;
                            count      = 1;
                            tmp        = 0;
                            if (min == true)
                            {
                                first.TheA *= -1;
                                min         = false;
                            }
                        }
                        else if (i + 1 == str.Length)
                        {
                            first.TheB = tmp;
                            count      = 1;
                            tmp        = 0;
                            if (min == true)
                            {
                                first.TheB *= -1;
                                min         = false;
                            }
                        }
                    }
                    else
                    {
                        min = true;
                    }
                }
            }
            return(first);
        }
Example #2
0
 public Second()
 {
     A1B1 = new CoordAB(); A2B2 = new CoordAB(); YX = new CoordAB(1, 1);
 }