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

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

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

StringBuilder.codePointCount介绍

暂无

代码示例

代码示例来源:origin: jp.dodododo/samurai-dao

public int codePointCount(int beginIndex, int endIndex) {
  return delegator.codePointCount(beginIndex, endIndex);
}

代码示例来源:origin: com.github.javaito/hcjf

public int codePointCount(int beginIndex, int endIndex) {
  return builder.codePointCount(beginIndex, endIndex);
}

代码示例来源:origin: me.soliveirajr/menta-bean

public int codePointCount(int beginIndex, int endIndex) {
  return sb.codePointCount(beginIndex, endIndex);
}

代码示例来源:origin: com.jtransc/jtransc-rt

@Override
@JTranscAsync
public synchronized int codePointCount(int beginIndex, int endIndex) {
  return super.codePointCount(beginIndex, endIndex);
}

代码示例来源:origin: org.python/jython

@Override
public TextFormatter pad() {
  // We'll need this many pad characters (if>0). Note Spec.UNDEFINED<0.
  int n = spec.width - result.codePointCount(mark, result.length());
  if (n > 0) {
    pad(mark, n);
  }
  return this;
}

代码示例来源:origin: com.sqlapp/sqlapp-core

/**
 * 表示上の幅を取得します。
 * @param val
 */
public static int getDisplayWidth(StringBuilder val){
  if (val ==null){
    return 0;
  }
  int count=0;
  int i=0;
  int codePointLen=val.codePointCount(0, val.length());
  while(i<codePointLen){
    int codePoint=val.codePointAt(i++);
    if (isHalf(codePoint)){
      count++;
    } else{
      count=count+2;
    }
  }
  return count;
}

代码示例来源: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: rocks.xmpp/xmpp-extensions-client

while (i < sb.codePointCount(0, sb.length()) && i < pos) {
    charCount += Character.charCount(sb.codePointAt(charCount));
    i++;
while (i < sb.codePointCount(0, sb.length()) && i < pos) {
  if (i++ < pos - n) {
    startIndex += Character.charCount(sb.codePointAt(startIndex));

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

if (text == null)                  return 0;
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) {

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

if (text == null)                  return 0;
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) {

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

codePointCount  = buffer.codePointCount(0, printableLength);
onLineBegin(true);

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

codePointCount  = buffer.codePointCount(0, printableLength);
onLineBegin(true);

代码示例来源:origin: omegat-org/omegat

int getBreakPos(Token[] tokens) {
  if (str.codePointCount(0, str.length()) <= maxLineLength) {
  if (str.codePointCount(0, latestNonSpacesTokenPos) <= maxLineLength) {
    return str.length();
    if (str.codePointCount(0, t.getOffset()) >= lineLength) {
      if (spacesStart >= 0 && str.codePointCount(0, spacesStart) < maxLineLength) {
        return t.getOffset();
    int cps = str.codePointCount(0, t.getOffset());
    if (cps >= lineLength && cps < maxLineLength) {
      if (isSpaces(t)) {
    cps = str.codePointCount(0, t.getOffset() + t.getLength());
    if (cps >= lineLength && cps < maxLineLength) {
      if (isSpaces(t)) {
    int cps = str.codePointCount(0, t.getOffset());
    if (cps >= lineLength && cps < maxLineLength) {
      if (isPossibleBreakBefore(t.getOffset())) {
    cps = str.codePointCount(0, t.getOffset() + t.getLength());
    if (cps >= lineLength && cps < maxLineLength) {
      if (isPossibleBreakBefore(t.getOffset() + t.getLength())) {
    if (str.codePointCount(0, t.getOffset()) >= lineLength) {
      if (i == 0) {
        return t.getOffset() + t.getLength();

代码示例来源:origin: eclipse/rdf4j

c = previousChar;
prefix.setLength(prefix.length() - 1);
previousChar = prefix.codePointAt(prefix.codePointCount(0, prefix.length()) - 1);

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client

c = previousChar;
prefix.setLength(prefix.length() - 1);
previousChar = prefix.codePointAt(prefix.codePointCount(0, prefix.length()) - 1);

代码示例来源:origin: smola/galimatias

for (int i = 0; i < buffer.codePointCount(0, buffer.length()); i++) {
  final int otherChar = buffer.codePointAt(i);
  final char startChar = buffer.charAt(i);

相关文章

微信公众号

最新文章

更多