public final class StringCharacterIterator extends Object implements CharacterIterator
StringCharacterIterator实现一个
String的
CharacterIterator协议,
StringCharacterIterator类遍历整个
String。
CharacterIterator
DONE| Constructor and Description |
|---|
StringCharacterIterator(String text)
用0的初始索引构造一个迭代器。
|
StringCharacterIterator(String text, int pos)
用指定的初始索引构造一个迭代器。
|
StringCharacterIterator(String text, int begin, int end, int pos)
在给定字符串的给定范围内构造一个迭代器,并用指定位置设置的索引。
|
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
创建此迭代器的副本。
|
char |
current()
实现了characteriterator current()字符串。
|
boolean |
equals(Object obj)
比较两stringcharacteriterator对象平等。
|
char |
first()
实现了characteriterator first()字符串。
|
int |
getBeginIndex()
实现了characteriterator getbeginindex()字符串。
|
int |
getEndIndex()
实现了characteriterator getendindex()字符串。
|
int |
getIndex()
实现了characteriterator getindex()字符串。
|
int |
hashCode()
计算出这个迭代器hashCode。
|
char |
last()
实现了characteriterator last()字符串。
|
char |
next()
实现了characteriterator next()字符串。
|
char |
previous()
实现了characteriterator previous()字符串。
|
char |
setIndex(int p)
实现了characteriterator setindex()字符串。
|
void |
setText(String text)
重置此迭代器指向一个新的字符串。
|
public StringCharacterIterator(String text)
text -
String要遍历
public StringCharacterIterator(String text, int pos)
text -要遍历字符串
pos初始迭代器位置
public StringCharacterIterator(String text, int begin, int end, int pos)
text -要遍历字符串
begin -第一个字符的索引
end -以下的最后一个字符的字符索引
pos初始迭代器位置
public void setText(String text)
text -要遍历字符串
public char first()
first 接口
CharacterIterator
CharacterIterator.first()
public char last()
last 接口
CharacterIterator
CharacterIterator.last()
public char setIndex(int p)
setIndex 接口
CharacterIterator
p -在文本中的位置。有效值的范围从getbeginindex()到getendindex()。IllegalArgumentException是如果提供了一个无效的值被。
CharacterIterator.setIndex(int)
public char current()
current 接口
CharacterIterator
CharacterIterator.current()
public char next()
next 接口
CharacterIterator
CharacterIterator.next()
public char previous()
previous 接口
CharacterIterator
CharacterIterator.previous()
public int getBeginIndex()
getBeginIndex 接口
CharacterIterator
CharacterIterator.getBeginIndex()
public int getEndIndex()
getEndIndex 接口
CharacterIterator
CharacterIterator.getEndIndex()
public int getIndex()
getIndex 接口
CharacterIterator
CharacterIterator.getIndex()
public boolean equals(Object obj)
equals 方法重写,继承类
Object
obj - stringcharacteriterator对象进行比较。
Object.hashCode(),
HashMap
public int hashCode()
hashCode 方法重写,继承类
Object
Object.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.