/** * Returns the index within this sequence that is offset from the * given <code>index</code> by <code>codePointOffset</code> code * points. Unpaired surrogates within the text range given by * <code>index</code> and <code>codePointOffset</code> count as * one code point each. * * @param index the index to be offset * @param codePointOffset the offset in code points * @return the index within this sequence * @exception IndexOutOfBoundsException if <code>index</code> * is negative or larger then the length of this sequence, * or if <code>codePointOffset</code> is positive and the subsequence * starting with <code>index</code> has fewer than * <code>codePointOffset</code> code points, * or if <code>codePointOffset</code> is negative and the subsequence * before <code>index</code> has fewer than the absolute value of * <code>codePointOffset</code> code points. */ public int offsetByCodePoints(int index, int codePointOffset) { if (index < 0 || index > count) { throw new IndexOutOfBoundsException(); } return Character.offsetByCodePointsImpl(value, 0, count, index, codePointOffset); }
/** * Returns the index within this sequence that is offset from the * given <code>index</code> by <code>codePointOffset</code> code * points. Unpaired surrogates within the text range given by * <code>index</code> and <code>codePointOffset</code> count as * one code point each. * * @param index the index to be offset * @param codePointOffset the offset in code points * @return the index within this sequence * @exception IndexOutOfBoundsException if <code>index</code> * is negative or larger then the length of this sequence, * or if <code>codePointOffset</code> is positive and the subsequence * starting with <code>index</code> has fewer than * <code>codePointOffset</code> code points, * or if <code>codePointOffset</code> is negative and the subsequence * before <code>index</code> has fewer than the absolute value of * <code>codePointOffset</code> code points. */ public int offsetByCodePoints(int index, int codePointOffset) { if (index < 0 || index > count) { throw new IndexOutOfBoundsException(); } return Character.offsetByCodePointsImpl(value, 0, count, index, codePointOffset); }
throw new IndexOutOfBoundsException(); return offsetByCodePointsImpl(a, start, count, index, codePointOffset);
throw new IndexOutOfBoundsException(); return offsetByCodePointsImpl(a, start, count, index, codePointOffset);
/** * Returns the index within this <code>String</code> that is * offset from the given <code>index</code> by * <code>codePointOffset</code> code points. Unpaired surrogates * within the text range given by <code>index</code> and * <code>codePointOffset</code> count as one code point each. * * @param index the index to be offset * @param codePointOffset the offset in code points * @return the index within this <code>String</code> * @exception IndexOutOfBoundsException if <code>index</code> * is negative or larger then the length of this * <code>String</code>, or if <code>codePointOffset</code> is positive * and the substring starting with <code>index</code> has fewer * than <code>codePointOffset</code> code points, * or if <code>codePointOffset</code> is negative and the substring * before <code>index</code> has fewer than the absolute value * of <code>codePointOffset</code> code points. * @since 1.5 */ public int offsetByCodePoints(int index, int codePointOffset) { if (index < 0 || index > length()) { throw new IndexOutOfBoundsException(); } return Character.offsetByCodePointsImpl(toCharArray(), offset(), length(), offset()+index, codePointOffset) - offset(); }
/** * Returns the index within this <code>String</code> that is * offset from the given <code>index</code> by * <code>codePointOffset</code> code points. Unpaired surrogates * within the text range given by <code>index</code> and * <code>codePointOffset</code> count as one code point each. * * @param index the index to be offset * @param codePointOffset the offset in code points * @return the index within this <code>String</code> * @exception IndexOutOfBoundsException if <code>index</code> * is negative or larger then the length of this * <code>String</code>, or if <code>codePointOffset</code> is positive * and the substring starting with <code>index</code> has fewer * than <code>codePointOffset</code> code points, * or if <code>codePointOffset</code> is negative and the substring * before <code>index</code> has fewer than the absolute value * of <code>codePointOffset</code> code points. * @since 1.5 */ public int offsetByCodePoints(int index, int codePointOffset) { if (index < 0 || index > length()) { throw new IndexOutOfBoundsException(); } return Character.offsetByCodePointsImpl(toCharArray(), offset(), length(), offset()+index, codePointOffset) - offset(); }