Function: indexOfStylename

Returns the index of the given stylename in the given style. This
returns -1 if the given stylename does not occur (as a stylename) in the
given style, otherwise it returns the index of the first character.
509199
function(style, stylename)
	{
		if (style != null && stylename != null)
		{
			var tokens = style.split(';');
			var pos = 0;
			
			for (var i = 0; i < tokens.length; i++)
			{
				if (tokens[i] == stylename)
				{
					return pos;
				}
				
				pos += tokens[i].length + 1;
			}
		}

		return -1;
	}
444884
public NamedStyleInfo getNamedStyleInfo(String name) {
		for (NamedStyleInfo info : namedStyleInfos) {
			if (info.getName().equals(name)) {
				return info;
			}
		}
		return null;
	}
170647
public int compareTo(UnicodeSet o, ComparisonStyle style) {
        if (style != ComparisonStyle.LEXICOGRAPHIC) {
            int diff = size() - o.size();
            if (diff != 0) {
                return (diff < 0) == (style == ComparisonStyle.SHORTER_FIRST) ? -1 : 1;
            }
        }
        int result;
        for (int i = 0; ; ++i) {
            if (0 != (result = list[i] - o.list[i])) {
                // if either list ran out, compare to the last string
                if (list[i] == HIGH) {
                    if (strings.isEmpty()) return 1;
                    String item = strings.first();
                    return compare(item, o.list[i]);
                }
                if (o.list[i] == HIGH) {
                    if (o.strings.isEmpty()) return -1;
                    String item = o.strings.first();
                    int compareResult = compare(item, list[i]);
                    return compareResult > 0 ? -1 : compareResult < 0 ? 1 : 0; // Reverse the order.
                }
                // otherwise return the result if even index, or the reversal if not
                return (i & 1) == 0 ? result : -result;
            }
            if (list[i] == HIGH) {
                break;
            }
        }
        return compare(strings, o.strings);
    }
625317
def index_of(self, name):
        
        result = -1
        for index, actor in enumerate(self.actors):
            if actor.name == name:
                result = index
                break
        return result
369118
public final Optional<? extends Style> getStyle(final String styleName) {
        final String styleRef = this.styles.get(styleName);
        if (styleRef != null) {
            return this.styleParser.loadStyle(this, this.clientHttpRequestFactory, styleRef);
        } else {
            return Optional.empty();
        }


    }
920109
Index getIndex(String indexName) {

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

        return i == -1 ? null
                       : indexes[i];
    }
1364578
function _indexOf(a,s){
	// Do we need the hack?
	if(a.indexOf){
		return a.indexOf(s);
	}

	for(var j=0;j<a.length;j++){
		if(a[j]===s){
			return j;
		}
	}
	return -1;
}
191336
function keysIndex(a) {
    var keys = [],
        l,
        k,
        i;

    for (i = 0, l = a.length; i < l; i++)
      for (k in a[i])
        if (!~keys.indexOf(k))
          keys.push(k);

    return keys;
  }
170836
static String extractStyle(String style, String attribute) {
		if (style == null) {
			return "";
		}
		
		StringTokenizer tokens = new StringTokenizer(style,";");
		
		while (tokens.hasMoreTokens()) {
			String token = tokens.nextToken();
			String key = token.substring(0,token.indexOf(':'));
			if (key.equals(attribute)) {
				return token.substring(token.indexOf(':')+1);
			}
		}
		
		return "";
	}
1124248
def getStyleDict(self):
        '''
            
        '''

        # TODO: This method is not used and does not appear in any tests.

        styleStr = (self.getAttribute('style') or '').strip()
        styles = styleStr.split(';') # Won't work for strings containing semicolon..
        styleDict = OrderedDict()
        for item in styles:
            try:
                splitIdx = item.index(':')
                name = item[:splitIdx].strip().lower()
                value = item[splitIdx+1:].strip()
                styleDict[name] = value
            except:
                continue

        return styleDict
985284
private int[] getStyle(int index) {
        if (m_styleOffsets==null || m_styles==null ||
                index>=m_styleOffsets.length)
        {
            return null;
        }
        int offset=m_styleOffsets[index]/4;
        int style[];
        {
            int count=0;
            for (int i=offset;i<m_styles.length;++i) {
                if (m_styles[i]==-1) {
                    break;
                }
                count+=1;
            }
            if (count==0 || (count%3)!=0) {
                return null;
            }
            style=new int[count];
        }
        for (int i=offset,j=0;i<m_styles.length;) {
            if (m_styles[i]==-1) {
                break;
            }
            style[j++]=m_styles[i++];
        }
        return style;
    }
611207
public int getNameIndex(CharSequence name)
    {
        for (ConstantInfo ci : listConstantInfo(Utf8.class))
        {
            Utf8 utf8 = (Utf8) ci;
            String str = utf8.getString();
            if (str.contentEquals(name))
            {
                return constantPoolIndexMap.get(ci);
            }
        }
        return -1;
    }
760200
def _lookup_style(element, names):
    '''
    
    '''
    return _STYLES.get('_'+element, '') + \
        ''.join([_STYLES.get(name, '') for name in names])
508775
static int getIndex(CharSequence name) {
        Integer index = STATIC_INDEX_BY_NAME.get(name);
        if (index == null) {
            return -1;
        }
        return index;
    }
965387
def indexOf(self, editor):
        
        lay = self.layout()
        for i in range(lay.count()):
            if lay.itemAt(i).widget() == editor:
                return i
        return -1
632590
int getIndexIndex(String indexName) {

        Index[] indexes = indexList;

        for (int i = 0; i < indexes.length; i++) {
            if (indexName.equals(indexes[i].getName().name)) {
                return i;
            }
        }

        // no such index
        return -1;
    }
1279195
public int getCount(T style)
    {
        Integer cnt = styles.get(style);
        return cnt == null ? 0 : cnt;
    }