Package java.text

Examples of java.text.BreakIterator.first()


    final CharacterEntityParser entityParser = HtmlCharacterEntities.getEntityParser();
    final BreakIterator instance = BreakIterator.getLineInstance();
    instance.setText(text);

    int start = instance.first();
    int end = instance.next();

    boolean flagStart = true;
    while (end != BreakIterator.DONE)
    {
View Full Code Here


     * 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

     * 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

     * 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

     * 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

  private int countWords(String text, Locale locale) {
    int count = 0;
    BreakIterator wordIterator = BreakIterator.getWordInstance(locale);
   
    wordIterator.setText(text);
    int start = wordIterator.first();
    int end = wordIterator.next();
    while (end != BreakIterator.DONE) {
      char ch = text.charAt(start);
      if (Character.isLetterOrDigit(ch)) {
        count++;
View Full Code Here

   
    int count = 0;
    BreakIterator characterIterator = BreakIterator.getCharacterInstance(locale);
   
    characterIterator.setText(text);
    int start = characterIterator.first();
    int end = characterIterator.next();
    while (end != BreakIterator.DONE) {
      char ch = text.charAt(start);
      if (Character.isLetterOrDigit(ch)) {
        count++;
View Full Code Here

    final List<AttributedCharacterIterator> lines = new LinkedList<AttributedCharacterIterator>();

    final BreakIterator iter = BreakIterator.getLineInstance();
    iter.setText(text.getIterator());
   
    int previous = iter.first();
   
    AttributedCharacterIterator best = null;
   
    while (iter.next() != BreakIterator.DONE) {
      final AttributedCharacterIterator candidate = text.getIterator(null, previous, iter.current());
View Full Code Here

        BreakIterator iter = BreakIterator.getLineInstance();
        iter.setText(s);
        StringBuilder res = new StringBuilder(initialIndent);
        StringBuilder sb = new StringBuilder();
        int currentWidth = initialOffset + initialIndent.length();
        for (int start = iter.first(), end = iter.next(); end != BreakIterator.DONE; start = end, end = iter
                .next()) {
            String sub = s.substring(start, end);
            int subwidth = textWidthCounter.width(sub);
            currentWidth += subwidth;
            if (currentWidth > width) {
View Full Code Here

       
        int lineCount = 0;
        final int lineHeight = fm.getHeight();
       
        // offsets for String.substring(start, end);
        int startOffset = bi.first();
        int endOffset = bi.next();
        // we go over each possible line break that BreakIterator suggests.
        do {
          if(endOffset == text.length()) {
            // we are at the end. this would cause IllegalArgumentException
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.