public final class StringCharacterIterator 
 extends Object implements CharacterIterator
| java.lang.Object | |
| ↳ | java.text.StringCharacterIterator | 
StringCharacterIterator实现CharacterIterator协议为String 。 StringCharacterIterator类遍历整个String 。
也可以看看:
Inherited constants |  
      
|---|
  java.text.CharacterIterator  
         |  
      
Public constructors |  
      |
|---|---|
  StringCharacterIterator(String text)  构造一个初始索引为0的迭代器。  |  
      |
  StringCharacterIterator(String text, int pos)  用指定的初始索引构造一个迭代器。  |  
      |
  StringCharacterIterator(String text, int begin, int end, int pos)  在给定字符串的给定范围内构造一个迭代器,索引设置在指定位置。  |  
      |
Public methods |  
      |
|---|---|
 Object  |  
         clone()  创建此迭代器的副本。  |  
      
 char  |  
         current()  为String实现CharacterIterator.current()。  |  
      
 boolean  |  
         equals(Object obj)  比较两个StringCharacterIterator对象的相等性。  |  
      
 char  |  
         first()  为String实现CharacterIterator.first()。  |  
      
 int  |  
         getBeginIndex()  为String实现CharacterIterator.getBeginIndex()。  |  
      
 int  |  
         getEndIndex()  为String实现CharacterIterator.getEndIndex()。  |  
      
 int  |  
         getIndex()  为String实现CharacterIterator.getIndex()。  |  
      
 int  |  
         hashCode()  计算此迭代器的哈希码。  |  
      
 char  |  
         last()  为String实现CharacterIterator.last()。  |  
      
 char  |  
         next()  为String实现CharacterIterator.next()。  |  
      
 char  |  
         previous()  为String实现CharacterIterator.previous()。  |  
      
 char  |  
         setIndex(int p)  为String实现CharacterIterator.setIndex()。  |  
      
 void  |  
         setText(String text)  重置此迭代器以指向新的字符串。  |  
      
Inherited methods |  
      |
|---|---|
  java.lang.Object  
         |  
      |
  java.text.CharacterIterator  
         |  
      |
StringCharacterIterator (String text)
构造一个初始索引为0的迭代器。
| Parameters | |
|---|---|
text |  
         String 
          |  
       
StringCharacterIterator (String text, int pos)
用指定的初始索引构造一个迭代器。
| Parameters | |
|---|---|
text |  
         String: The String to be iterated over |  
       
pos |  
         int: Initial iterator position  |  
       
StringCharacterIterator (String text, int begin, int end, int pos)
在给定字符串的给定范围内构造一个迭代器,索引设置在指定位置。
| Parameters | |
|---|---|
text |  
         String: The String to be iterated over |  
       
begin |  
         int: Index of the first character |  
       
end |  
         int: Index of the character following the last character |  
       
pos |  
         int: Initial iterator position  |  
       
char current ()
为String实现CharacterIterator.current()。
| Returns | |
|---|---|
char |  
        the character at the current position or DONE if the current position is off the end of the text. | 
也可以看看:
boolean equals (Object obj)
比较两个StringCharacterIterator对象的相等性。
| Parameters | |
|---|---|
obj |  
         Object: the StringCharacterIterator object to be compared with. |  
       
| Returns | |
|---|---|
boolean |  
        true if the given obj is the same as this StringCharacterIterator object; false otherwise. | 
char first ()
为String实现CharacterIterator.first()。
| Returns | |
|---|---|
char |  
        the first character in the text, or DONE if the text is empty | 
也可以看看:
int getBeginIndex ()
为String实现CharacterIterator.getBeginIndex()。
| Returns | |
|---|---|
int |  
        the index at which the text begins. | 
也可以看看:
int getEndIndex ()
为String实现CharacterIterator.getEndIndex()。
| Returns | |
|---|---|
int |  
        the index after the last character in the text | 
也可以看看:
int getIndex ()
为String实现CharacterIterator.getIndex()。
| Returns | |
|---|---|
int |  
        the current index. | 
也可以看看:
char last ()
为String实现CharacterIterator.last()。
| Returns | |
|---|---|
char |  
        the last character in the text, or DONE if the text is empty | 
也可以看看:
char next ()
为String实现CharacterIterator.next()。
| Returns | |
|---|---|
char |  
        the character at the new position or DONE if the new position is off the end of the text range. | 
也可以看看:
char previous ()
为String实现CharacterIterator.previous()。
| Returns | |
|---|---|
char |  
        the character at the new position or DONE if the current position is equal to getBeginIndex(). | 
也可以看看:
char setIndex (int p)
为String实现CharacterIterator.setIndex()。
| Parameters | |
|---|---|
p |  
         int: the position within the text. Valid values range from getBeginIndex() to getEndIndex(). An IllegalArgumentException is thrown if an invalid value is supplied. |  
       
| Returns | |
|---|---|
char |  
        the character at the specified position or DONE if the specified position is equal to getEndIndex() | 
也可以看看:
void setText (String text)
重置此迭代器以指向新的字符串。 这个包可见方法被其他java.text类使用,这些类想要在每次调用setText方法时避免分配新的StringCharacterIterator对象。
| Parameters | |
|---|---|
text |  
         String: The String to be iterated over |