<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Class java.text.StringCharacterIterator
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.text.html">This Package</a>  <a href="java.text.SimpleDateFormat.html#_top_">Previous</a>  <a href="Package-java.text.html">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.text.StringCharacterIterator
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----java.text.StringCharacterIterator
</pre>
<hr>
<dl>
  <dt> public final class <b>StringCharacterIterator</b>
  <dt> extends <a href="java.lang.Object.html#_top_">Object</a>
  <dt> implements <a href="java.text.CharacterIterator.html#_top_">CharacterIterator</a>
</dl>
<code>StringCharacterIterator</code> implements the
 <code>CharacterIterater</code> protocol for a <code>String</code>.
 The <code>StringCharacterIterator</code> class iterates over the
 entire <code>String</code>.
 <P>
 <strong>Examples</strong>:
 <P>
 Traverse the text from start to finish
 <blockquote>
 <pre>
 public void traverseForward(CharacterIterator iter) {
     for (char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
         processChar(c);
     }
 }
 </pre>
 </blockquote>
 Traverse the text backwards, from end to start
 <blockquote>
 <pre>
 public void traverseBackward(CharacterIterator iter) {
     for (char c = iter.last(); c != CharacterIterator.DONE; c = iter.prev()) {
         processChar(c);
     }
 }
 </pre>
 </blockquote>
 Traverse both forward and backward from a given position in the text.
 <blockquote>
 <pre>
 public void traverseOut(CharacterIterator iter, int pos) {
     for (char c = iter.setIndex(pos);
          c != CharacterIterator.DONE && notBoundary(c);
          c = iter.next()) {}
     int end = iter.getIndex();
     for (char c = iter.setIndex(pos);
          c != CharacterIterator.DONE && notBoundary(c);
          c = iter.prev()) {}
     int start = iter.getIndex();
     processSection(iter.getText.subString(start,end);
 }
 </pre>
 </blockquote>
<p>
<hr>
<a name="index"></a>
<h2>
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#StringCharacterIterator(java.lang.String)"><b>StringCharacterIterator</b></a>(String)
  <dd>  Construct an iterator with an initial index of 0.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#StringCharacterIterator(java.lang.String, int)"><b>StringCharacterIterator</b></a>(String, int)
  <dd>  Construct an iterator with the specified initial index.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#StringCharacterIterator(java.lang.String, int, int, int)"><b>StringCharacterIterator</b></a>(String, int, int, int)
  <dd>  Construct an iterator over the given range of the given string, with the
 index set at the specified position.
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#clone()"><b>clone</b></a>()
  <dd>  Create a copy of this boundary
 
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#current()"><b>current</b></a>()
  <dd>  Get the character at the current position (as returned by getIndex()).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#equals(java.lang.Object)"><b>equals</b></a>(Object)
  <dd>  Compares the equality of two StringCharacterIterator objects.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#first()"><b>first</b></a>()
  <dd>  Set the position to getBeginIndex() and return the character at that
 position.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getBeginIndex()"><b>getBeginIndex</b></a>()
  <dd>  Return the start index of the text.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getEndIndex()"><b>getEndIndex</b></a>()
  <dd>  Return the end index of the text.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getIndex()"><b>getIndex</b></a>()
  <dd>  Return the current index.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#hashCode()"><b>hashCode</b></a>()
  <dd>  Compute a hashcode for this enumeration
 
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#last()"><b>last</b></a>()
  <dd>  Set the position to getEndIndex() and return the
 character at that position.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#next()"><b>next</b></a>()
  <dd>  Increment the iterator's index by one and return the character
 at the new index.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#previous()"><b>previous</b></a>()
  <dd>  Decrement the iterator's index by one and return the character
 at the new index.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setIndex(int)"><b>setIndex</b></a>(int)
  <dd>  Set the position to specified position in the text and return that
 character.
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="StringCharacterIterator"></a>
<a name="StringCharacterIterator(java.lang.String)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>StringCharacterIterator</b>
<pre>
 public StringCharacterIterator(<a href="java.lang.String.html#_top_">String</a> text)
</pre>
<dl>
  <dd> Construct an iterator with an initial index of 0.
<p>
</dl>
<a name="StringCharacterIterator(java.lang.String, int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>StringCharacterIterator</b>
<pre>
 public StringCharacterIterator(<a href="java.lang.String.html#_top_">String</a> text,
                                int pos)
</pre>
<dl>
  <dd> Construct an iterator with the specified initial index.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> text - The String to be iterated over
    <dd> pos - Initial iterator position
  </dl></dd>
</dl>
<a name="StringCharacterIterator(java.lang.String, int, int, int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>StringCharacterIterator</b>
<pre>
 public StringCharacterIterator(<a href="java.lang.String.html#_top_">String</a> text,
                                int begin,
                                int end,
                                int pos)
</pre>
<dl>
  <dd> Construct an iterator over the given range of the given string, with the
 index set at the specified position.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> text - The String to be iterated over
    <dd> begin - Index of the first character
    <dd> end - Index of the character following the last character
    <dd> pos - Initial iterator position
  </dl></dd>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="first()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="first"><b>first</b></a>
<pre>
 public char first()
</pre>
<dl>
  <dd> Set the position to getBeginIndex() and return the character at that
 position.
<p>
</dl>
<a name="last()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="last"><b>last</b></a>
<pre>
 public char last()
</pre>
<dl>
  <dd> Set the position to getEndIndex() and return the
 character at that position.
<p>
</dl>
<a name="setIndex(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setIndex"><b>setIndex</b></a>
<pre>
 public char setIndex(int p)
</pre>
<dl>
  <dd> Set the position to specified position in the text and return that
 character.
<p>
</dl>
<a name="current()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="current"><b>current</b></a>
<pre>
 public char current()
</pre>
<dl>
  <dd> Get the character at the current position (as returned by getIndex()).
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the character at the current position or DONE if the current
 position is off the end of the text.
  </dl></dd>
</dl>
<a name="next()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="next"><b>next</b></a>
<pre>
 public char next()
</pre>
<dl>
  <dd> Increment the iterator's index by one and return the character
 at the new index.  If the resulting index is greater or equal
 to getEndIndex(), the current index is reset to getEndIndex() and
 a value of DONE is returned.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the character at the new position or DONE if the current
 position is off the end of the text.
  </dl></dd>
</dl>
<a name="previous()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="previous"><b>previous</b></a>
<pre>
 public char previous()
</pre>
<dl>
  <dd> Decrement the iterator's index by one and return the character
 at the new index.  If the resulting index is
 less than getBeginIndex(), the current index is reset to getBeginIndex()
 and a value of DONE is returned.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the character at the new position or DONE if the current
 position is off the end of the text.
  </dl></dd>
</dl>
<a name="getBeginIndex()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getBeginIndex"><b>getBeginIndex</b></a>
<pre>
 public int getBeginIndex()
</pre>
<dl>
  <dd> Return the start index of the text.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the index at which the text begins.
  </dl></dd>
</dl>
<a name="getEndIndex()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getEndIndex"><b>getEndIndex</b></a>
<pre>
 public int getEndIndex()
</pre>
<dl>
  <dd> Return the end index of the text.  This index is the index of the
 first character following the end of the text.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the index at which the text end.
  </dl></dd>
</dl>
<a name="getIndex()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getIndex"><b>getIndex</b></a>
<pre>
 public int getIndex()
</pre>
<dl>
  <dd> Return the current index.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the current index.
  </dl></dd>
</dl>
<a name="equals(java.lang.Object)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="equals"><b>equals</b></a>
<pre>
 public boolean equals(<a href="java.lang.Object.html#_top_">Object</a> obj)
</pre>
<dl>
  <dd> Compares the equality of two StringCharacterIterator objects.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> obj - the StringCharacterIterator object to be compared with.
    <dt> <b>Returns:</b>
    <dd> true if the given obj is the same as this
 StringCharacterIterator object; false otherwise.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#equals(java.lang.Object)">equals</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</dl>
<a name="hashCode()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="hashCode"><b>hashCode</b></a>
<pre>
 public int hashCode()
</pre>
<dl>
  <dd> Compute a hashcode for this enumeration
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> A hash code
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#hashCode()">hashCode</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</dl>
<a name="clone()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="clone"><b>clone</b></a>
<pre>
 public <a href="java.lang.Object.html#_top_">Object</a> clone()
</pre>
<dl>
  <dd> Create a copy of this boundary
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> A copy of this
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#clone()">clone</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.text.html">This Package</a>  <a href="java.text.SimpleDateFormat.html#_top_">Previous</a>  <a href="Package-java.text.html">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
