Package java.text

Examples of java.text.BreakIterator.first()


    for (String text : texts) {
      SparseVector fv = new SparseVector();
      res.add(fv);
     
      wordIt.setText(text);
        int start = wordIt.first();
        int end = wordIt.next();
       
        while (end != BreakIterator.DONE) {
            String word = text.substring(start,end);
            if (Character.isLetterOrDigit(word.charAt(0))) {
View Full Code Here


  private void renderText(String text) {
    BreakIterator iter = BreakIterator.getWordInstance();
    if (text != null) {
      iter.setText(text);
      int start = iter.first(), end;
      int nLines = 0;

      do {
        end = iter.next();
View Full Code Here

        if (bi.isBoundary(fullIndex)) {
            return Character.isWhitespace(s.array[fullIndex])
                   ? index + 1 : index;
        }
        int prev = bi.preceding(fullIndex);
        if (prev == bi.first()) {
            return index;
        }
        return prev - offset;
    }
View Full Code Here

        if (bi.isBoundary(fullIndex)) {
            return Character.isWhitespace(s.array[fullIndex])
                   ? index + 1 : index;
        }
        int prev = bi.preceding(fullIndex);
        if (prev == bi.first()) {
            return index;
        }
        return prev - offset;
    }
View Full Code Here

        final BreakIterator bi = BreakIterator.getWordInstance();
        final Segment text = getText(startOffset, endOffset);
        bi.setText(text);

        int prev;
        int curr = bi.first() - text.offset;
        int next;
        do {
            prev = curr;
            next = bi.next();
            curr = next != BreakIterator.DONE ? next - text.offset
View Full Code Here

        public String toString(Tag tag) {
            BreakIterator bi = BreakIterator.getSentenceInstance(Locale.US);
            String text = tag.text();
            bi.setText(text);
            int first = bi.first();
            int next = bi.next();
            if (text.length() == 0) {
                first = next = 0;
            }
            return STATUS + "<dd><em>Obsolete.</em> <font color='red'>Will be removed in " + text.substring(first, next) + "</font>. " + text.substring(next) + "</dd>";
View Full Code Here

      StringBuilder sBuf = new StringBuilder(sValue.toLowerCase(locale));
      BreakIterator itr = BreakIterator.getWordInstance(locale);

      itr.setText(sValue);

      for (int i = itr.first(); i < nLength; i = itr.next())
      {
         sBuf.setCharAt(i, Character.toTitleCase(sValue.charAt(i)));
      }

      return sBuf.toString();
View Full Code Here

        final GlyphPainter p = getGlyphPainter();

        float width = 0;
        float fragmentWidth;
        int prev;
        int curr = bi.first() - text.offset;
        int next;
        int ws = -1;
        boolean whitespace;
        do {
            prev = curr;
View Full Code Here

   
  public void test_next() {
    // Regression test for HARMONY-30
    BreakIterator bi = BreakIterator.getWordInstance(Locale.US);
    bi.setText("This is the test, WordInstance");
    int n = bi.first();
    n = bi.next();
    assertEquals("Assert 0: next() returns incorrect value ", 4, n);
       
        assertEquals(BreakIterator.DONE, iterator.next());
        iterator.setText(TEXT);
View Full Code Here

        final GlyphPainter p = getGlyphPainter();

        float width = 0;
        float fragmentWidth;
        int prev;
        int curr = bi.first() - text.offset;
        int next;
        int ws = -1;
        boolean whitespace;
        do {
            prev = curr;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.