Checks to see if a string contains a variable of type ${variableName}
embedded within it.

@param string to check
@param variableName to check for
@return true/false
435477
public static boolean hasVariable( final String string,
                                       final String variableName )
    {
        return ( string.indexOf( VARIABLE_START_DELIM + variableName
                + VARIABLE_END_DELIM ) >= 0 );
    }
65750
private VarNamePattern getValidVarNamePattern( String varNamePattern) throws IllegalArgumentException
    {
    VarNamePattern pattern = new VarNamePattern( varNamePattern);
    if( !pattern.isValid())
      {
      throw new IllegalArgumentException( "\"" + pattern + "\" is not a valid variable name pattern");
      }

    return pattern;
    }
924685
private static boolean isValidBrace(String url) {
        if (null == url || url.trim().length() == 0) {
            return false;
        }

        boolean isInsideVariable = false;
        StringTokenizer tokenizer = new StringTokenizer(url, "{}", true);
        while (tokenizer.hasMoreTokens()) {
            String token = tokenizer.nextToken();
            if (token.equals("{")) {
                // { is not allowed inside of a variable specification
                if (isInsideVariable) {
                    return false;
                }
                isInsideVariable = true;
            } else if (token.equals("}")) {
                // } must be preceded by {;
                if (!isInsideVariable) {
                    return false;
                }
                isInsideVariable = false;
            }
        }
        return true;
    }
700162
def is_valid_varname(self, name, item):
        
        check_valid_varname(name, self._custom_units, self._structs, self._constants, item)
        if name in self._globals:
            raise VariableDeclarationException(
                'Invalid name "%s", previously defined as global.' % name, item
            )
        return True
432396
function checkVariable(variable) {
            astUtils.getModifyingReferences(variable.references).forEach(reference => {
                context.report({ node: reference.identifier, messageId: "unexpected" });
            });
        }
785629
public static function contains(string $string, $values): bool
    {
        foreach ((array) $values as $value) {
            if (strpos($string, $value) !== false) {
                return true;
            }
        }

        return false;
    }
866369
public boolean matches(String string) {		
		Matcher matcher = pattern.matcher(string);
		boolean result = matcher.matches();
		return result;		
	}
1104803
def contains_variables_from_set(expression, variables):
    """"""
    if hasattr(expression, 'variable_name') and expression.variable_name in variables:
        return True
    if isinstance(expression, Operation):
        return any(contains_variables_from_set(o, variables) for o in op_iter(expression))
    return False
286746
public final boolean containsAllNames(VariableNumMap other) {
    int[] otherNums = other.nums;
    String[] otherNames = other.names;

    for (int i = 0; i < otherNums.length; i++) {
      int index = getVariableIndex(otherNums[i]);
      if (index < 0 || !otherNames[i].equals(names[index])) {
        return false;
      }
    }
    return true;
  }
621943
function findVariables(string) {
  // Do not parse empty files. Otherwise gonzales.parse will fail
  if (!string) {
    return [];
  }

  var out = [],
      ast = gonzales.parse(string, {
        syntax: 'less'
      });

  ast.traverseByType('value', function(subAst) {
    subAst.traverseByType('variable', function(node) {
      out.push(node.content.toString());
    });
  });

  return out;
}
1029860
private static String getVariableName(String value) {
        assert value.charAt(0) == '{';
        assert value.charAt(value.length() - 1) == '}';
        return value.substring(1, value.length() - 1);
    }
826421
static public function contains($string, $needle, $message = null, $propertyPath = null, $encoding = 'utf8')
        {
            static::string($string);

            if (mb_strpos($string, $needle, null, $encoding) === false) {
                $message = $message ?: sprintf(
                    'Value "%s" does not contain "%s".',
                    static::stringify($string),
                    static::stringify($needle)
                );

                $constraints = array('needle' => $needle, 'encoding' => $encoding);

                throw static::createException($string, $message, static::INVALID_STRING_CONTAINS, $propertyPath, $constraints);
            }
        }
1155016
public boolean isVariableMapped(String pVarName){
        if(variables == null){
            return false;
        }
        for (Variable vo : variables) {
            if(vo.getName().equals(pVarName)){
                return true;
            }
        }
        return false;
    }
829913
private boolean checkContains(String fieldName, String... propNames) {

        for (String propName : propNames) {
            if (fieldName.contains("/" + propName + "/")) {
                return true;
            }
        }
        return false;
    }
1354528
def check_valid_varname(varname,
                        custom_units,
                        custom_structs,
                        constants,
                        pos,
                        error_prefix="Variable name invalid.",
                        exc=None):
    
    exc = VariableDeclarationException if exc is None else exc

    valid_varname, msg = is_varname_valid(varname, custom_units, custom_structs, constants)
    if not valid_varname:
        raise exc(error_prefix + msg, pos)

    return True
275205
@Override
    public Map<String, String> getValues(String variableContains) {
        final Map<String, String> variableSelection = new HashMap<>();
        String key;
        for (Map.Entry<Descriptors.FieldDescriptor, Object> fieldEntry : message.getAllFields().entrySet()) {
            key = StringProcessor.transformToUpperCase(fieldEntry.getKey().getName());
            if (key.contains(variableContains) || (StringProcessor.transformToUpperCase(message.getClass().getSimpleName()) + "/" + key).contains(variableContains)) {
                if (!fieldEntry.getValue().toString().isEmpty()) {
                    variableSelection.put(key, fieldEntry.getValue().toString());
                }
            }
        }
        return variableSelection;
    }
463830
public static function contains($string = false, $substring = false) {

        if ($substring && $substring && strpos($string, $substring) !== false) {

            return true;
        }

        return false;
    }