Returns the index in the table of the provided string. Adds the string to
        the table if it's not there.
        :param string: the input string.
963621
def stringIndex(self, string):
        
        if string in self.table:
            return self.table[string]
        else:
            result = self.current_index
            self.table[string] = result
            self.current_index += self.c_strlen(string)
            return result
760827
function _string_shift(&$string, $index = 1)
    {
        $substr = substr($string, 0, $index);
        $string = substr($string, $index);
        return $substr;
    }
906571
public function insert($index, $string)
    {
        // NOTE: This could be slightly confusing as the parameters
        // are back to front. I guess I could change the Str version...

        $this->str = $this->str->insert((string)$string, $index);

        return $this;
    }
593143
public static int lastIndexOfLetter(String string) {
    for (int i = 0; i < string.length(); i++) {
      char character = string.charAt(i);
      // Include "_".  See HHH-8073
      if (!Character.isLetter(character) && !('_' == character)) return i - 1;
    }
    return string.length() - 1;
  }
912490
public static int substr_count(final String string, final String substring) {
        if(substring.length()==1) {
            return substr_count(string, substring.charAt(0));
        }
        
        int count = 0;
        int idx = 0;

        while ((idx = string.indexOf(substring, idx)) != -1) {
           ++idx;
           ++count;
        }

        return count;
    }
424890
def append(index, str)
      check_index(index)
      window = @session.request(:nvim_get_current_win)
      cursor = window.cursor

      set_lines(index, index, true, [*str.split($/)])
      window.set_cursor(cursor)
      str
    end
292614
public int convertStringToIndex(String tempString)
    {
        String tempChar = tempString;
        if (tempChar.length() == 0)
            tempChar = " ";
        if ((tempChar.charAt(0) == 'Y') || (tempChar.charAt(0) == 'y'))
            return 1;
        else
            return 0;
    }
302513
def iter(self, string):
		
		state = self.root
		for index, c in enumerate(string):
			while c not in state.children:
				state = state.fail

			state = state.children.get(c, self.root)

			tmp = state
			output = []
			while tmp is not nil:
				if tmp.output is not nil:
					output.append(tmp.output)

				tmp = tmp.fail

			if output:
				yield (index, output)
443761
def add_accent_at(string, accent, index):
    
    if index == -1:
        return string
    # Python can handle the case which index is out of range of given string
    return string[:index] + \
        accent.accent.add_accent_char(string[index], accent) + \
        string[index+1:]
477546
public static int index(String string) {
        int length = string.length();
        for (int i = 0; i < length; i++) {
            if (getCorrespondingSymbol(string.charAt(i)) != ' ') {
                return i;
            }
        }
        return -1;
    }
425397
public static function insert($string, $substring, $index)
    {
        exception_if(!self::checkIndex($string, $index), StringOutIndexException::class);

        $str = '';

        for ($i = 0; $i < static::length($string); $i++) {
            if ($i == $index) {
                $str .= $substring;
            }

            $str .= $string[$i];
        }

        return $str;
    }
1072314
@Override
    public V get(String s, int offset, int len) {
        int t = 0;
        for (int i = 0; i < len; i++) {
            char c = s.charAt(offset + i);
            int index = __lookup[c & 0x7f];
            if (index >= 0) {
                int idx = t * ROW_SIZE + index;
                t = _rowIndex[idx];
                if (t == 0)
                    return null;
            } else {
                char[] big = _bigIndex == null ? null : _bigIndex[t];
                if (big == null)
                    return null;
                t = big[c];
                if (t == 0)
                    return null;
            }
        }
        return _value[t];
    }
1186178
def get_from_string(cls, string_phase):
        

        if string_phase == 'Pending':
            return cls.PENDING
        elif string_phase == 'Running':
            return cls.RUNNING
        elif string_phase == 'Succeeded':
            return cls.SUCCEEDED
        elif string_phase == 'Failed':
            return cls.FAILED
        elif string_phase == 'Unknown':
            return cls.UNKNOWN

        return cls.UNKNOWN
683306
function (S, index, unicode) {
  return index + (unicode ? stringAt(S, index, true).length : 1);
}
74719
def match_string(self, string, word=0, offset=0):
        
        if word:
            return self.get_string(offset) == string
        return self.get_length(len(string), offset) == string
1257791
def adds(self, string):
        
        if isinstance(string, unicode):
            string = string.encode("utf-8")

        self.children.append((STRING, str(string)))
351501
public static ArrayList<Integer> findDistinctIndexesOf( String string, String substringToLookFor )
  {
    ArrayList<Integer> positions = new ArrayList<Integer>();

    if( GosuStringUtil.isEmpty( substringToLookFor ) )
    {
      return positions;
    }

    int i = 0;
    i = GosuStringUtil.indexOf( string, substringToLookFor, i );
    while( i != -1 )
    {
      positions.add( i );
      i += substringToLookFor.length();
      i = GosuStringUtil.indexOf( string, substringToLookFor, i );
    }
    return positions;
  }