Package com.ibm.icu.text

Examples of com.ibm.icu.text.BreakIterator.first()


    // compile against JCL Foundation (bug 80053).
    // Also need to do this in an NL-sensitive way. The use of BreakIterator
    // was suggested in bug 90579.
    BreakIterator iter = BreakIterator.getWordInstance();
    iter.setText(text);
    int i = iter.first();
    while (i != java.text.BreakIterator.DONE && i < text.length()) {
      int j = iter.following(i);
      if (j == java.text.BreakIterator.DONE) {
        j = text.length();
      }
View Full Code Here


        int offset = iterator.first();
        int testOffset;
        int count = 0;

        do {
            testOffset = testIterator.first();
            testOffset = testIterator.next(count);
            logln("next(" + count + ") -> " + testOffset);
            if (offset != testOffset)
                errln("next(n) and next() not returning consistent results: for step " + count + ", next(n) returned " + testOffset + " and next() had " + offset);
View Full Code Here

    {
        String testString = "boo.";
        BreakIterator wb = BreakIterator.getWordInstance();
        wb.setText(testString);

        if (wb.first() != 0)
            errln("Didn't get break at beginning of string.");
        if (wb.next() != 3)
            errln("Didn't get break before period in \"boo.\"");
        if (wb.current() != 4 && wb.next() != 4)
            errln("Didn't get break at end of string.");
View Full Code Here

     **/
    public void TestPreceding() {
        String words3 = "aaa bbb ccc";
        BreakIterator e = BreakIterator.getWordInstance(Locale.getDefault());
        e.setText( words3 );
        e.first();
        int p1 = e.next();
        int p2 = e.next();
        int p3 = e.next();
        int p4 = e.next();

View Full Code Here

      return;
    ArrayList list = new ArrayList();
    BreakIterator wb = BreakIterator.getLineInstance();
    wb.setText(getText());
    int cursor = 0;
    for (int loc = wb.first(); loc != BreakIterator.DONE; loc = wb.next()) {
      if (loc == 0)
        continue;
      String word = text.substring(cursor, loc);
      Point extent = gc.textExtent(word);
      list.add(new TextFragment((short) loc, (short) extent.x));
View Full Code Here

    wb.setText(text);
    int last = 0;

    int width = 0;

    for (int loc = wb.first(); loc != BreakIterator.DONE; loc = wb.next()) {
      String word = text.substring(last, loc);
      Point extent = gc.textExtent(word);
      width = Math.max(width, extent.x);
      last = loc;
    }
View Full Code Here

    int saved = 0;
    int last = 0;
    int height = lineHeight;
    int maxWidth = 0;
    for (int loc = wb.first(); loc != BreakIterator.DONE; loc = wb.next()) {
      String word = text.substring(saved, loc);
      Point extent = gc.textExtent(word);
      if (extent.x > wHint) {
        // overflow
        saved = last;
View Full Code Here

    int saved = 0;
    int last = 0;
    int y = bounds.y;
    int width = bounds.width;

    for (int loc = wb.first(); loc != BreakIterator.DONE; loc = wb.next()) {
      String line = text.substring(saved, loc);
      Point extent = gc.textExtent(line);

      if (extent.x > width) {
        // overflow
View Full Code Here

        wb.setText(text);
        int last = 0;

        int width = 0;

        for (int loc = wb.first(); loc != BreakIterator.DONE; loc = wb.next()) {
            String word = text.substring(last, loc);
            Point extent = gc.textExtent(word);
            width = Math.max(width, extent.x);
            last = loc;
        }
View Full Code Here

        int saved = 0;
        int last = 0;
        int height = lineHeight;
        int maxWidth = 0;
        for (int loc = wb.first(); loc != BreakIterator.DONE; loc = wb.next()) {
            String word = text.substring(saved, loc);
            Point extent = gc.textExtent(word);
            if (extent.x > wHint) {
                // overflow
                saved = last;
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.