Examples of CharacterIterator


Examples of java.text.CharacterIterator

    public String encode( String text ) {
        if (text == null) return null;
        if (text.length() == 0) return text;
        StringBuilder sb = new StringBuilder();
        String hex = null;
        CharacterIterator iter = new StringCharacterIterator(text);
        for (char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
            if (c == '_') {
                // Read the next character (if there is one) ...
                char next = iter.next();
                if (next == CharacterIterator.DONE) {
                    sb.append(c);
                    break;
                }
                // If the next character is not 'x', then these are just regular characters ...
View Full Code Here

Examples of java.text.CharacterIterator

     * @see org.jboss.dna.common.text.TextEncoder#encode(java.lang.String)
     */
    public String encode( String text ) {
        if (text == null) return null;
        StringBuilder sb = new StringBuilder();
        CharacterIterator iter = new StringCharacterIterator(text);
        for (char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
            switch (c) {
                case '&':
                    sb.append("&");
                    break;
                case '"':
View Full Code Here

Examples of org.apache.regexp.CharacterIterator

    if (r == null || str == null) {
      throw new IllegalArgumentException("参数不正确,不能是null对象!");
    }
    List strList = new ArrayList();
    RE patt = new RE(str);
    CharacterIterator in = new ReaderCharacterIterator(r);
    int end = 0;

    while (patt.match(in, end)) {
      int start = patt.getParenStart(0);
      end = patt.getParenEnd(0);
      strList.add(in.substring(start, end));
    }

    String[] tempStr = (String[]) strList.toArray(new String[strList.size()]);
    return tempStr;
  }
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.