| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
The
StringIterator class provides a convenient way
to iterate through each character of a string as you could do with
a
List instance.
Iterations are performed from 0 to the length
of the passed-in string.
protected var _bAdded:Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
protected var _bRemoved:Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
protected var _nGap:Number
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
protected var _nIndex:Number
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
protected var _nSize:Number
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
protected var _sString:String
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
public function StringIterator(s:String, gap:Number = 1, i:uint = 0)
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Creates a new string iterator to iterate through
each character of the passed-in string.
Parameters
| s:String — String iterator's target
|
| |
| gap:Number (default = 1) — gap
|
| |
| i:uint (default = 0) — iterator's start index
|
Throws
| — NullPointerException — if the string's target is null
|
| |
| — IndexOutOfBoundsException — if the index is out of range
|
public function add(o:Object):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Inserts the specified element into the list (optional operation).
The element is inserted immediately before the next element that
would be returned by next, if any, and after the next element
that would be returned by previous, if any. (If the list contains
no elements, the new element becomes the sole element on the list.)
The new element is inserted before the implicit cursor: a subsequent
call to next would be unaffected, and a subsequent call to previous
would return the new element. (This call increases by one the value
that would be returned by a call to nextIndex or previousIndex.)
Parameters
| o:Object — the element to insert.
|
Throws
| — IllegalArgumentException — The passed-in string couldn't be added due to its length
|
public function hasNext():Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns true if the iteration has more elements.
(In other words, returns true if next would return
an element rather than throwing an exception.)
Returns
| Boolean — true if the iterator has more elements.
|
public function hasPrevious():Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns true if this list iterator has more elements when
traversing the list in the reverse direction. (In other words,
returns true if previous would return an element
rather than throwing an exception.)
Returns
| Boolean — true if the list iterator has more elements when
traversing the list in the reverse direction.
|
public function next():*
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns the next element in the iteration. Calling this method
repeatedly until the hasNext() method returns false will return
each element in the underlying collection exactly once.
Returns
| * — the next element in the iteration.
|
public function nextIndex():uint
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns the index of the element that would be returned
by a subsequent call to next. (Returns list size if the
list iterator is at the end of the list.)
Returns
| uint — the index of the element that would be returned
by a subsequent call to next, or list size if list
iterator is at end of list.
|
public function previous():*
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns the previous element in the list. This method
may be called repeatedly to iterate through the list
backwards, or intermixed with calls to next to go back
and forth. (Note that alternating calls to next and
previous will return the same element repeatedly.)
Returns
| * — the previous element in the list.
|
public function previousIndex():uint
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns the index of the element that would be returned
by a subsequent call to previous. (Returns -1
if the list iterator is at the beginning of the list.)
Returns
| uint — the index of the element that would be returned
by a subsequent call to previous, or -1
if list iterator is at beginning of list.
|
public function remove():void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Removes from the underlying collection the last element returned
by the iterator (optional operation). This method can be called
only once per call to next. The behavior of an iterator is unspecified
if the underlying collection is modified while the iteration is in
progress in any way other than by calling this method.
public function set(o:Object):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Parameters
Throws
| — IllegalArgumentException — The passed-in string couldn't be set due to its length
|
LowRA API documentation 2008- 2009
Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1
mer. févr. 25 2009, 9:22 AM GMT+01:00