java.lang.Character.codePointBeforeImpl()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中java.lang.Character.codePointBeforeImpl()方法的一些代码示例,展示了Character.codePointBeforeImpl()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Character.codePointBeforeImpl()方法的具体详情如下:
包路径:java.lang.Character
类名称:Character
方法名:codePointBeforeImpl

Character.codePointBeforeImpl介绍

暂无

代码示例

代码示例来源:origin: org.apidesign.bck2brwsr/emul.mini

/**
 * Returns the code point preceding the given index of the
 * {@code char} array. If the {@code char} value at
 * {@code (index - 1)} in the {@code char} array is in
 * the low-surrogate range, {@code (index - 2)} is not
 * negative, and the {@code char} value at {@code (index - 2)}
 * in the {@code char} array is in the
 * high-surrogate range, then the supplementary code point
 * corresponding to this surrogate pair is returned. Otherwise,
 * the {@code char} value at {@code (index - 1)} is
 * returned.
 *
 * @param a the {@code char} array
 * @param index the index following the code point that should be returned
 * @return the Unicode code point value before the given index.
 * @exception NullPointerException if {@code a} is null.
 * @exception IndexOutOfBoundsException if the {@code index}
 * argument is less than 1 or greater than the length of the
 * {@code char} array
 * @since  1.5
 */
public static int codePointBefore(char[] a, int index) {
  return codePointBeforeImpl(a, index, 0);
}

代码示例来源:origin: jtulach/bck2brwsr

/**
 * Returns the code point preceding the given index of the
 * {@code char} array. If the {@code char} value at
 * {@code (index - 1)} in the {@code char} array is in
 * the low-surrogate range, {@code (index - 2)} is not
 * negative, and the {@code char} value at {@code (index - 2)}
 * in the {@code char} array is in the
 * high-surrogate range, then the supplementary code point
 * corresponding to this surrogate pair is returned. Otherwise,
 * the {@code char} value at {@code (index - 1)} is
 * returned.
 *
 * @param a the {@code char} array
 * @param index the index following the code point that should be returned
 * @return the Unicode code point value before the given index.
 * @exception NullPointerException if {@code a} is null.
 * @exception IndexOutOfBoundsException if the {@code index}
 * argument is less than 1 or greater than the length of the
 * {@code char} array
 * @since  1.5
 */
public static int codePointBefore(char[] a, int index) {
  return codePointBeforeImpl(a, index, 0);
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul.mini

throw new IndexOutOfBoundsException();
return codePointBeforeImpl(a, index, start);

代码示例来源:origin: jtulach/bck2brwsr

throw new IndexOutOfBoundsException();
return codePointBeforeImpl(a, index, start);

代码示例来源:origin: jtulach/bck2brwsr

/**
 * Returns the character (Unicode code point) before the specified
 * index. The index refers to <code>char</code> values
 * (Unicode code units) and ranges from <code>1</code> to {@link
 * CharSequence#length() length}.
 *
 * <p> If the <code>char</code> value at <code>(index - 1)</code>
 * is in the low-surrogate range, <code>(index - 2)</code> is not
 * negative, and the <code>char</code> value at <code>(index -
 * 2)</code> is in the high-surrogate range, then the
 * supplementary code point value of the surrogate pair is
 * returned. If the <code>char</code> value at <code>index -
 * 1</code> is an unpaired low-surrogate or a high-surrogate, the
 * surrogate value is returned.
 *
 * @param     index the index following the code point that should be returned
 * @return    the Unicode code point value before the given index.
 * @exception IndexOutOfBoundsException if the <code>index</code>
 *            argument is less than 1 or greater than the length
 *            of this string.
 * @since     1.5
 */
public int codePointBefore(int index) {
  int i = index - 1;
  if ((i < 0) || (i >= length())) {
    throw new StringIndexOutOfBoundsException(index);
  }
  return Character.codePointBeforeImpl(toCharArray(), offset() + index, offset());
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul.mini

/**
 * Returns the character (Unicode code point) before the specified
 * index. The index refers to <code>char</code> values
 * (Unicode code units) and ranges from <code>1</code> to {@link
 * CharSequence#length() length}.
 *
 * <p> If the <code>char</code> value at <code>(index - 1)</code>
 * is in the low-surrogate range, <code>(index - 2)</code> is not
 * negative, and the <code>char</code> value at <code>(index -
 * 2)</code> is in the high-surrogate range, then the
 * supplementary code point value of the surrogate pair is
 * returned. If the <code>char</code> value at <code>index -
 * 1</code> is an unpaired low-surrogate or a high-surrogate, the
 * surrogate value is returned.
 *
 * @param     index the index following the code point that should be returned
 * @return    the Unicode code point value before the given index.
 * @exception IndexOutOfBoundsException if the <code>index</code>
 *            argument is less than 1 or greater than the length
 *            of this string.
 * @since     1.5
 */
public int codePointBefore(int index) {
  int i = index - 1;
  if ((i < 0) || (i >= length())) {
    throw new StringIndexOutOfBoundsException(index);
  }
  return Character.codePointBeforeImpl(toCharArray(), offset() + index, offset());
}

代码示例来源:origin: stackoverflow.com

//Java 8 java.lang.String source code
public int codePointAt(int index) {
  if ((index < 0) || (index >= value.length)) {
    throw new StringIndexOutOfBoundsException(index);
  }
  return Character.codePointAtImpl(value, index, value.length);
}
//...
public int codePointBefore(int index) {
  int i = index - 1;
  if ((i < 0) || (i >= value.length)) {
    throw new StringIndexOutOfBoundsException(index);
  }
  return Character.codePointBeforeImpl(value, index, 0);
}

相关文章

微信公众号

最新文章

更多

Character类方法