public static bool DoesFormulaContainComponent(string formula, string component)
        {
            if (component == string.Empty)
            {
                return(false);
            }

            formula   = formula.ToLower();
            component = component.ToLower();

            for (int index = formula.IndexOf(component); index >= 0; index = formula.IndexOf(component))
            {
                if (index != 0) //check character before place of finding
                {
                    if (EM_Helpers.IsLetterOrDigit(formula.ElementAt(index - 1)) || formula.ElementAt(index - 1) == '_')
                    {
                        formula = formula.Substring(index + 1);
                        continue; //if a letter, digit or underscore: word does not begin with component (e.g. look for 'bun' find 'yabun')
                    }
                }

                index = index + component.Length;
                if (index < formula.Length - 1) //check character after place of finding
                {
                    if (EM_Helpers.IsLetterOrDigit(formula.ElementAt(index)) || formula.ElementAt(index) == '_')
                    {
                        formula = formula.Substring(1);
                        continue; //if a letter, digit or underscore: word does not end with component (e.g. look for 'bun_s' find 'bun')
                    }
                }
                return(true);
            }

            return(false);
        }
        public static bool ContainsIllegalChar(string toTest, ref string errorText, string additionallyAllowedChar = "")
        {
            string illegal = string.Empty;

            foreach (char c in toTest.ToList <char>())
            {
                if (!EM_Helpers.IsLetterOrDigit(c) && c != '_' && !additionallyAllowedChar.Contains(c))
                {
                    illegal += "'" + c + "' ";
                }
            }

            if (illegal != string.Empty)
            {
                errorText = "Illegal character(s) " + illegal + "used";
            }

            return(illegal != string.Empty);
        }