Package java.text

Examples of java.text.StringCharacterIterator.current()


     * Note that JSTL's {@code <c:out>} escapes the exact same set of characters as this method.
     */
    public static String escapeCharsForXML(String aText) {
        final StringBuilder result = new StringBuilder();
        final StringCharacterIterator iterator = new StringCharacterIterator(aText);
        char character = iterator.current();
        while (character != CharacterIterator.DONE) {
            if (character == '<') {
                result.append("&lt;");
            }
            else if (character == '>') {
View Full Code Here


            if(m=='-') {
                c1=wrap_ci.previous();
                c2=ci.previous();
            } else if(m=='0') {
                c1=wrap_ci.current();
                c2=ci.current();
            } else  {// m=='+'
                c1=wrap_ci.next();
                c2=ci.next();
            }
   
View Full Code Here

  protected String escapeRegexpChars(String input) {
    final CharacterIterator charIterator = new StringCharacterIterator(input);
    final StringBuilder result = new StringBuilder();

    while (true) {
      final char cha = charIterator.current();

      if (cha == CharacterIterator.DONE) {
        return result.toString();

      }
View Full Code Here

        //int current = 0;
        byte b = 0;
        boolean stop = false;
        StringCharacterIterator it = new StringCharacterIterator(str);
        do {
            b = _dec(it.current());
            it.next();
            if(b>45) throw new CoderException("can't decode string ["+str+"]");
            if(b<45) stop=true;
            len += b;
            for(; b > 0; b -= 3) {
View Full Code Here

     * Note that JSTL's {@code <c:out>} escapes the exact same set of characters as this method.
     */
    public static String escapeCharsForXML(String aText) {
        final StringBuilder result = new StringBuilder();
        final StringCharacterIterator iterator = new StringCharacterIterator(aText);
        char character = iterator.current();
        while (character != CharacterIterator.DONE) {
            if (character == '<') {
                result.append("&lt;");
            }
            else if (character == '>') {
View Full Code Here

  /**
   * @tests java.text.StringCharacterIterator.current()
   */
  public void test_current() {
    StringCharacterIterator fixture = new StringCharacterIterator("fixture");
    assertEquals('f', fixture.current());
    fixture.next();
    assertEquals('i', fixture.current());
       
                StringCharacterIterator it =
                    new StringCharacterIterator("testing", 2, 6, 4);
View Full Code Here

   */
  public void test_current() {
    StringCharacterIterator fixture = new StringCharacterIterator("fixture");
    assertEquals('f', fixture.current());
    fixture.next();
    assertEquals('i', fixture.current());
       
                StringCharacterIterator it =
                    new StringCharacterIterator("testing", 2, 6, 4);
                assertEquals("Wrong current char", 'i', it.current());
  }
View Full Code Here

    fixture.next();
    assertEquals('i', fixture.current());
       
                StringCharacterIterator it =
                    new StringCharacterIterator("testing", 2, 6, 4);
                assertEquals("Wrong current char", 'i', it.current());
  }

  /**
   * @tests java.text.StringCharacterIterator.first()
   */
 
View Full Code Here

        assertTrue("Wrong next char3", it1.next() == CharacterIterator.DONE);
        assertTrue("Wrong next char4", it1.next() == CharacterIterator.DONE);
        int index = it1.getIndex();
        assertEquals("Wrong index", 6, index);
        assertTrue("Wrong current char",
                   it1.current() == CharacterIterator.DONE);
  }

  /**
   * @tests java.text.StringCharacterIterator.previous()
   */
 
View Full Code Here

                assertTrue("Wrong previous char3",
                           it1.previous() == CharacterIterator.DONE);
                assertTrue("Wrong previous char4",
                           it1.previous() == CharacterIterator.DONE);
                assertEquals("Wrong index", 2, it1.getIndex());
                assertEquals("Wrong current char", 's', it1.current());
  }

  /**
   * @tests java.text.StringCharacterIterator.setIndex(int)
   */
 
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.