java.lang.StringBuffer.codePointCount()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(111)

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

StringBuffer.codePointCount介绍

暂无

代码示例

代码示例来源:origin: org.apache.sis.core/sis-utility

/**
 * Returns the number of Unicode code points in the given characters sequence,
 * or 0 if {@code null}. Unpaired surrogates within the text count as one code
 * point each.
 *
 * @param  text  the character sequence from which to get the count, or {@code null}.
 * @return the number of Unicode code points, or 0 if the argument is {@code null}.
 *
 * @see #codePointCount(CharSequence, int, int)
 */
public static int codePointCount(final CharSequence text) {
  if (text == null)                  return 0;
  if (text instanceof String)        return ((String)        text).codePointCount(0, text.length());
  if (text instanceof StringBuilder) return ((StringBuilder) text).codePointCount(0, text.length());
  if (text instanceof StringBuffer)  return ((StringBuffer)  text).codePointCount(0, text.length());
  if (text instanceof CharBuffer) {
    final CharBuffer buffer = (CharBuffer) text;
    if (buffer.hasArray() && !buffer.isReadOnly()) {
      return Character.codePointCount(buffer.array(), buffer.position(), buffer.limit());
    }
  }
  return Character.codePointCount(text, 0, text.length());
}

代码示例来源:origin: apache/sis

/**
 * Returns the number of Unicode code points in the given characters sequence,
 * or 0 if {@code null}. Unpaired surrogates within the text count as one code
 * point each.
 *
 * @param  text  the character sequence from which to get the count, or {@code null}.
 * @return the number of Unicode code points, or 0 if the argument is {@code null}.
 *
 * @see #codePointCount(CharSequence, int, int)
 */
public static int codePointCount(final CharSequence text) {
  if (text == null)                  return 0;
  if (text instanceof String)        return ((String)        text).codePointCount(0, text.length());
  if (text instanceof StringBuilder) return ((StringBuilder) text).codePointCount(0, text.length());
  if (text instanceof StringBuffer)  return ((StringBuffer)  text).codePointCount(0, text.length());
  if (text instanceof CharBuffer) {
    final CharBuffer buffer = (CharBuffer) text;
    if (buffer.hasArray() && !buffer.isReadOnly()) {
      return Character.codePointCount(buffer.array(), buffer.position(), buffer.limit());
    }
  }
  return Character.codePointCount(text, 0, text.length());
}

代码示例来源:origin: org.apache.sis.core/sis-utility

if (text instanceof String)        return ((String)        text).codePointCount(fromIndex, toIndex);
if (text instanceof StringBuilder) return ((StringBuilder) text).codePointCount(fromIndex, toIndex);
if (text instanceof StringBuffer)  return ((StringBuffer)  text).codePointCount(fromIndex, toIndex);
if (text instanceof CharBuffer) {
  final CharBuffer buffer = (CharBuffer) text;

代码示例来源:origin: apache/sis

if (text instanceof String)        return ((String)        text).codePointCount(fromIndex, toIndex);
if (text instanceof StringBuilder) return ((StringBuilder) text).codePointCount(fromIndex, toIndex);
if (text instanceof StringBuffer)  return ((StringBuffer)  text).codePointCount(fromIndex, toIndex);
if (text instanceof CharBuffer) {
  final CharBuffer buffer = (CharBuffer) text;

代码示例来源:origin: apache/sis

i -= Character.charCount(c);
currentLineLength = buffer.codePointCount(i, length);

代码示例来源:origin: org.apache.sis.core/sis-utility

int available = maximumTotalWidth - toAppendTo.codePointCount(offset, toAppendTo.length());
available -= (width + 1); // Remove the amount of code points that we plan to write.
if (suffix != null) {

代码示例来源:origin: apache/sis

int available = maximumTotalWidth - toAppendTo.codePointCount(offset, toAppendTo.length());
available -= (width + 1); // Remove the amount of code points that we plan to write.
if (suffix != null) {

相关文章