KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > text > StringCharacterIterator

java.text
Class StringCharacterIterator

java.lang.Object
  extended by java.text.StringCharacterIterator
All Implemented Interfaces:
Cloneable, CharacterIterator
See Also:
Top Examples, Source Code

public Object clone()
See Also:
Cloneable, CharacterIterator
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public char current()
See Also:
CharacterIterator
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean equals(Object obj)
See Also:
Hashtable, Object.hashCode()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public char first()
See Also:
CharacterIterator
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int getBeginIndex()
See Also:
CharacterIterator
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int getEndIndex()
See Also:
CharacterIterator
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int getIndex()
See Also:
CharacterIterator
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int hashCode()
See Also:
Hashtable, Object.equals(java.lang.Object)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public char last()
See Also:
CharacterIterator
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public char next()
See Also:
CharacterIterator
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public char previous()
See Also:
CharacterIterator
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public char setIndex(int p)
See Also:
CharacterIterator
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setText(String text)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public StringCharacterIterator(String text)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public StringCharacterIterator(String text,
                               int pos)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[88]Iterating a string
By Stephanie Tam on 2002/10/15 02:53:42  Rate
public static String formatForDB ( String s )   {  
     if  ( s == null )  
       return new String (  ) ; 
  
  
     StringCharacterIterator sci = new StringCharacterIterator ( s ) ; 
     String result = ""; 
      
     for  ( char ch = sci.first (  ) ; ch != CharacterIterator.DONE; ch = sci.next (  )  )   {  
       result += processChar ( ch ) ; 
       System.out.println (  "" + ch + " = " + result  ) ; 
      }  
     System.out.println ( "After filtering the string, it is \n" + result  ) ; 
  
  
     return result; 
    }  
    
      
   private static String processChar ( char ch )   {  
     if  ( ch == '\'' )   {   
       return "\''"; 
      }  else if  ( ch == '"' )   {  
       return "\\" + "\""; 
      }  else if  ( ch == '\\' )   {  
       return "\\" + "\\"; 
      }  else if  ( ch == '\b' )   {  
       return "\\b"; 
      }  else if  ( ch == '\n' )   {  
       return "\\n"; 
      }  else if  ( ch == '\r' )   {  
       return "\\r"; 
      }  else  {  
       return "" + ch; 
      }  
      }  


public StringCharacterIterator(String text,
                               int begin,
                               int end,
                               int pos)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags