ContainsWithoutStrings() static private method

Returns if an expression contains a value, disregarding content within string literals.
static private ContainsWithoutStrings ( string expression, string value ) : bool
expression string
value string
return bool
Ejemplo n.º 1
0
 private string EvaluateLambda(string exp)
 {
     if (StringEscapeHelper.ContainsWithoutStrings(exp, "=>") && Regex.IsMatch(exp, REGEX_LAMBDA))
     {
         return(BuildLambdaFunction(exp));
     }
     else
     {
         return(exp);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns if the expression is an assignment statement.
        /// </summary>
        private static bool IsAssignmentStatement(string code)
        {
            if (StringEscapeHelper.ContainsWithoutStrings(code, "="))
            {
                // Replace "=" that are not the assignment operator with placeholders:
                code = code.Replace("===", "---");
                code = code.Replace("!==", "---");
                code = code.Replace("==", "--");
                code = code.Replace("!=", "--");
                code = code.Replace("=>", "--");
                code = code.Replace("<=", "--");
                code = code.Replace(">=", "--");

                return(StringEscapeHelper.ContainsWithoutStrings(code, "="));
            }
            else
            {
                return(false);
            }
        }