Ejemplo n.º 1
0
        private static String CheckForBreaks(String str)
        {
            LOG.Debug("Check for breaks...");

            StringBuilder calc  = new StringBuilder(str);
            Match         match = null;

            do
            {
                LOG.Debug("Current: " + calc.ToString());

                match = Breaks.Match(calc.ToString());
                if (match.Success)
                {
                    LOG.Debug("Found match: " + match.Value);

                    //Get part
                    String part = match.Value.Substring(1, match.Value.Length - 2);
                    //Compute all operations to one double number
                    double value = CheckForOperatorsAndFunctions(part);

                    //Remove position included breaks
                    calc.Remove(match.Index, match.Length);
                    //Insert double number value on this place
                    calc.Insert(match.Index, value.ToString(CreateForToStringZeros()));

                    LOG.Debug("New string: " + calc.ToString());
                }
            } while (match.Success);

            LOG.Debug("Breaks result: " + str);
            return(calc.ToString());
        }