Package java.text

Examples of java.text.StringCharacterIterator


  {
    if ( str == null )
      return null ;
     
    char[] newStr = new char[str.length()] ;
    StringCharacterIterator iterator = new StringCharacterIterator(str) ;
    int i = 0 ;
       
    for(char ch = iterator.last(); ch != CharacterIterator.DONE; ch = iterator.previous())
    {
      newStr[i] = ch ;
      i++ ;
    }
    return new String( newStr )
View Full Code Here


    private void string(String string) {
        this.add('"');
        if(!matcher.reset(string).find()){
          add(string);
        }else {
          CharacterIterator it = new StringCharacterIterator(string);
          for (char c = it.first(); c != CharacterIterator.DONE; c = it.next()) {
              if (c == '"') {
                  this.add("\\\"");
              } else if (c == '\\') {
                  this.add("\\\\");
              } else if (c == '/') {
View Full Code Here

            this.next();
        }
    }

    public Object read(String string) throws JSONFault {
        this.it = new StringCharacterIterator(string);
        this.c = this.it.first();

        return this.read();
    }
View Full Code Here

  /** Count the number of standard separators in aPath. */
  private int numSeparatorsIn(String aPath) {
    char standardSeparator = STANDARD_SEPARATOR.charAt(0);
    int result = 0;
    StringCharacterIterator iterator = new StringCharacterIterator(aPath);
    char character = iterator.current();
    while (character != CharacterIterator.DONE) {
      if (character == standardSeparator) {
        result++;
      }
      character = iterator.next();
    }
    return result;
  }
View Full Code Here

        ExceptionUtils.checkEmpty(
            "modelElementName",
            modelElementName);

        StringBuffer sqlName = new StringBuffer();
        StringCharacterIterator iterator = new StringCharacterIterator(StringUtils.uncapitalize(modelElementName));

        for (char character = iterator.first(); character != CharacterIterator.DONE; character = iterator.next())
        {
            if (Character.isUpperCase(character))
            {
                sqlName.append(separator);
            }
View Full Code Here

     * position is reset to first().
     * @param newText new text to scan.
     */
    public void setText(String newText)
    {
        setText(new StringCharacterIterator(newText));
    }
View Full Code Here

    public CharacterIterator getText() {
        // The iterator is initialized pointing to no text at all, so if this
        // function is called while we're in that state, we have to fudge an
        // iterator to return.
        if (text == null) {
            text = new StringCharacterIterator("");
        }
        return text;
    }
View Full Code Here

         **/
        public Parser(String input)
        {
            this.input = input;

            ci = new StringCharacterIterator(input);
        }
View Full Code Here

    {
        this.input = input;
        this.zeroOrMoreChar = zeroOrMoreChar;
        this.anyChar = anyChar;
        this.escapeChar =escapeChar;
        ci = new StringCharacterIterator(input);
    }
View Full Code Here

     * @param str The expression string
     * @return The expression parts
     */
    public static String[] getExpressionsFromString(String str)
    {
        CharacterIterator ci = new StringCharacterIterator(str);
        int braces = 0;
        String text = "";
        ArrayList exprList = new ArrayList();
        while( ci.getIndex() != ci.getEndIndex() )
        {
            char c = ci.current();
            if( c == ',' && braces == 0)
            {
                exprList.add(text);
                text = "";
            }
            else if( c == '(' )
            {
                braces++;
                text += c;
            }
            else if( c == ')' )
            {
                braces--;
                text += c;
            }
            else
            {
                text += c;
            }
            ci.next();
        }
        exprList.add(text);
        return (String[])exprList.toArray(new String[exprList.size()]);
    }
View Full Code Here

TOP

Related Classes of java.text.StringCharacterIterator

Copyright © 2018 www.massapicom. 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.