Index of character in reference to the displayable text.
335027
def text_index_at_position(x, y)
      # Move caret to position the user clicks on.
      mouse_x, mouse_y = x - (self.x + padding_left), y - (self.y + padding_top)
      @char_widths.each.with_index do |width, i|
        char_x, char_y = @caret_positions[i]
        if mouse_x.between?(char_x, char_x + width) and mouse_y.between?(char_y, char_y + font.height)
          return i
        end
      end

      nil # Didn't find a character at that position.
    end
856151
private int getIndex(PdfName key) {
		for (int i = 0; i < VIEWER_PREFERENCES.length; i++) {
			if (VIEWER_PREFERENCES[i].equals(key))
				return i;
		}
		return -1;
	}
982785
def indexOf(self, pattern, start_idx, bitlength):
        
        return StrIndexOf(self, pattern, start_idx, bitlength)
502043
def linenum(self, index):
        """"""
        if len(self._lines) == 0 and self.refstring != "":
            self._lines = self.refstring.split("\n")
            #Add one for the \n that we split on for each line
            self._chars = [ len(x) + 1 for x in self._lines ]
            #Remove the last line break since it doesn't exist
            self._chars[-1] -= 1

            #Now we want to add up the number of characters in each line
            #as the lines progress so that it is easy to search for the
            #line of a single character index
            total = 0
            for i in range(len(self._chars)):
                total += self._chars[i]
                self._chars[i] = total

        if len(self._lines) > 0:
            #Now, find the first index where the character value is >= index
            result = -1
            i = 0
            while result == -1 and i < len(self._chars):
                if index <= self._chars[i]:
                    result = [ i, self._chars[i] - index]
                i += 1

            return result
        else:
            return [ -1, -1 ]
965387
def indexOf(self, editor):
        
        lay = self.layout()
        for i in range(lay.count()):
            if lay.itemAt(i).widget() == editor:
                return i
        return -1
606504
def _index(self):
        

        if self.y + 1 >= self.size[0]:
            # If the cursor is currently on the last row, then spawn another
            # and scroll down (removing the top row).
            self.display = self.display[1:] + [u" " * self.size[1]]
        else:
            # If the cursor is anywhere else, then just move it to the 
            # next line.
            self.y += 1
831124
@Deprecated
    public static int indexOf(CharSequence s, int codePoint) {
        int cp;
        for (int i = 0; i < s.length(); i += Character.charCount(cp)) {
            cp = Character.codePointAt(s, i);
            if (cp == codePoint) {
                return i;
            }
        }
        return -1;
    }
253595
private void incrementIndexes(int c) {
        if(c > 0) {
            this.index++;
            if(c=='\r') {
                this.line++;
                this.characterPreviousLine = this.character;
                this.character=0;
            }else if (c=='\n') {
                if(this.previous != '\r') {
                    this.line++;
                    this.characterPreviousLine = this.character;
                }
                this.character=0;
            } else {
                this.character++;
            }
        }
    }
148520
def index(self, item):
        ''
        k = self._key(item)
        i = bisect_left(self._keys, k)
        j = bisect_right(self._keys, k)
        return self._items[i:j].index(item) + i
592113
def index_of(pattern):
    ''''''
    return (pattern[0,0] * 2**0 + pattern[0,1] * 2**1 + pattern[0,2] * 2**2 +
            pattern[1,0] * 2**3 + pattern[1,1] * 2**4 + pattern[1,2] * 2**5 +
            pattern[2,0] * 2**6 + pattern[2,1] * 2**7 + pattern[2,2] * 2**8)
911490
def indexableText(self, include_properties=True):
        
        text = set()
        for extractor in self._text_extractors:
            if extractor.content_type in self.content_types.overrides:
                for tree in self.content_types.getTreesFor(self, extractor.content_type):
                    words = extractor.indexableText(tree)
                    text |= words

        if include_properties:
            for prop_value in self.allProperties.values():
                if prop_value is not None:
                    text.add(prop_value)
        return u' '.join([word for word in text])
827709
def _char_to_word_index(self, ci):
        
        i = None
        for i, co in enumerate(self.sentence.char_offsets):
            if ci == co:
                return i
            elif ci < co:
                return i - 1
        return i
179379
static private int indexOfNthOccurrenceOfCharIn(String str, char ch, int n) {
        boolean inMiddleOfQuote = false;
        int index = -1, previousIndex = 0;
        for (int i=0; i < n; i++) {
            do {
                index = str.indexOf(ch, index+1);
                if (index < 0) {
                    return -1;
                }
                if (hasOddNumberOfSingleQuotes(str.substring(previousIndex, index))) {
                    inMiddleOfQuote = !inMiddleOfQuote;
                }
                previousIndex = index;
            } while (inMiddleOfQuote);
        }
        return index;
    }
952846
def char(i):
    

    i = ord(i)
    if i not in font:
        return [(0,)] * 8
    return [(ord(row),) for row in font[i].decode('hex')]
604523
def display(self):
        """"""
        if self.title and self.organization:
            disp = self.title + u' at ' + self.organization
        else:
            disp = self.title or self.organization or None
        if disp and self.industry:
            if self.date_range is not None:
                disp += u' (%s, %d-%d)' % ((self.industry,) + \
                                           self.date_range.years_range)
            else:
                disp += u' (%s)' % self.industry
        else:
            disp = ((disp or u'') + u' ' + (self.industry or u'')).strip()
            if disp and self.date_range is not None:
                disp += u' (%d-%d)' % self.date_range.years_range
        return disp
546394
def characters(self):
        
        chars = 0
        for fragment in self.fragments:
            chars += fragment.characters
        return chars
1182060
def _charInfo(self, point, padding):
        
        print('{0:0>4X} '.format(point).rjust(padding), ud.name(chr(point), '<code point {0:0>4X}>'.format(point)))