Find the index of the specified name in field name array.
555378
private int findIndexForName(String[] fieldNames, String searchName)
    {
        for(int i = 0; i < fieldNames.length; i++)
        {
            if(searchName.equals(fieldNames[i]))
            {
                return i;
            }
        }
        throw new PersistenceBrokerException("Can't find field name '" + searchName +
                "' in given array of field names");
    }
1194857
@Override
    public int getIndex(String qName)
    {
        if (mElemStack == null) {
            return -1;
        }
        int ix = mElemStack.findAttributeIndex(null, qName);
        // !!! In ns-as-attrs mode, should also match ns decls?
        return ix;
    }
666744
public int getIndexOfField(String fieldName) {
		List<String> fnms = this.getFieldNames();
		for (int i = 0; i < fnms.size(); i++) {
			if (fnms.get(i).equals(fieldName))
				return i;
		}
		return -1;
	}
588596
def field_by_name(name)
      field = fields[name.to_sym] unless name.blank?
      if field.nil?
        dotted = name.to_s.split('.')[0]
        field = fields[dotted.to_sym] unless dotted.blank?
        if field && field.key_relation.nil?
          return nil
        end
      end
      field
    end
416700
private static int extractNonMatchingFields(Tuple<Type.Field> lhsFields, Tuple<Type.Field> rhsFields,
			Type.Field[] result, int index) {
		outer: for (int i = 0; i != lhsFields.size(); ++i) {
			for (int j = 0; j != rhsFields.size(); ++j) {
				Type.Field lhsField = lhsFields.get(i);
				Type.Field rhsField = rhsFields.get(j);
				Identifier lhsFieldName = lhsField.getName();
				Identifier rhsFieldName = rhsField.getName();
				if (lhsFieldName.equals(rhsFieldName)) {
					// This is a matching field. Therefore, continue on to the
					// next lhs field
					continue outer;
				}
			}
			result[index++] = lhsFields.get(i);
		}
		return index;
	}
1367981
public function getFieldIndex($name)
    {
        foreach ($this->getFields() as $index => $field) {
            if ($field->getName() === $name) {
                return $index;
            }
        }

        throw new FieldNotFoundException("Field `{$name}` not found.");
    }
830746
private static int findIndex(String[] array, String target){
        for (int i = 0; i < array.length; i++) {
            if (target.equals(array[i])) {
                return i;
            }
        }
        return -1;
    }
970144
private int findField(String fieldName) {
		int foundIndex = 0;
		for (Field field : fields) {
			if (field != null && fieldName.equals(field.getName())) {
				return foundIndex;
			}

			foundIndex++;
		}

		return -1;
	}
991192
def find_by_index(self, cls, index_name, value):
        """"""
        cur = self._conn().cursor()

        query = 'select id,value from %s where %s = ?' % (
            cls.get_table_name(),
            index_name
        )

        found = []
        for row in cur.execute(query, (value,)):
            id, data = row[0], row[1]
            obj = cls.from_data(data)
            assert id == obj.id
            found.append(obj)

        cur.close()

        return found
1284709
def get_index(self, name):
        
        catalog = self.get_catalog()
        index = catalog._catalog.getIndex(name)
        logger.debug("get_index={} of catalog '{}' --> {}".format(
            name, catalog.__name__, index))
        return index
1262023
public int getFieldIndex(String name) {
		Integer val = this.nameToIndex.get(name);
		if (val == null) {
			return -1;
		}
		return val;
	}
285820
def getSectionIndexByName(self, name):
        
        index = -1
        
        if name:
            for i in range(len(self.sectionHeaders)):
                if self.sectionHeaders[i].name.value.find(name) >= 0:
                    index = i
                    break
        return index
1304515
def lookupFieldIDByName( fieldName, dbid=nil )
      getSchema(dbid) if dbid
      ret = nil
      if @fields
         @fields.each_element_with_attribute( "id" ){ |f|
            if f.name == "field" and f.elements[ "label" ].text.downcase == fieldName.downcase
               ret = f.attributes[ "id" ].dup 
               break
            end
         }
      end
      ret
    end
920109
Index getIndex(String indexName) {

        Index[] indexes = indexList;
        int     i       = getIndexIndex(indexName);

        return i == -1 ? null
                       : indexes[i];
    }
962386
public int fieldIndex(String field) {
    Integer ret = mIndex.get(field);
    if (ret == null) {
      throw new IllegalArgumentException(field + " does not exist");
    }
    return ret;
  }
1037052
def _get_ordering_field_lookup(self, field_name):
        
        field = field_name
        get_field = getattr(self, "get_%s_ordering_field" % field_name, None)
        if get_field:
            field = get_field()
        return field
255238
def find_by_index(self, cls, index_name, value):
        """"""
        cur = self._conn().cursor()

        # psycopg2 supports using Python formatters for queries
        # we also request our JSON as a string for the from_data calls
        query = 'select id, value::text from {0} where {1} = %s;'.format(
            cls.get_table_name(),
            index_name
        )

        found = []
        with self._conn() as conn:
            with conn.cursor() as cur:
                cur.execute(query, (value,))
                for row in cur:
                    id, data = str(row[0]).strip(), row[1]
                    obj = cls.from_data(data)
                    assert id == obj.id
                    found.append(obj)

        return found