Packagesystem.data.iterators
Classpublic class StringIterator
InheritanceStringIterator Inheritance Object
Implements Iterator

Converts a string to an iterator.

Example :

     import system.data.Iterator ;
     import system.data.iterators.StringIterator ;
     
     var s:String = "Hello world" ;
     
     var it:Iterator = new StringIterator(s) ;
     
     it.seek( 1 ) ;
     
     while( it.hasNext() )
     {
         var char:String = it.next() ;
         trace( it.key() + ' : ' + char ) ;
     }
     
     trace (s) ;
     



Public Methods
 MethodDefined By
  
StringIterator(s:String)
Creates a new StringIterator instance.
StringIterator
  
hasNext():Boolean
Returns true if the iteration has more elements.
StringIterator
  
key():*
Returns the current key of the internal pointer of the iterator (optional operation).
StringIterator
  
next():*
Returns the next element in the iteration.
StringIterator
  
remove():*
Removes from the underlying collection the last element returned by the iterator (optional operation).
StringIterator
  
reset():void
Reset the internal pointer of the iterator (optional operation).
StringIterator
  
seek(position:*):void
Change the position of the internal pointer of the iterator (optional operation).
StringIterator
Constructor Detail
StringIterator()Constructor
public function StringIterator(s:String)

Creates a new StringIterator instance.

Parameters
s:String — the String object to enumerate.
Method Detail
hasNext()method
public function hasNext():Boolean

Returns true if the iteration has more elements.

Returns
Booleantrue if the iteration has more elements.
key()method 
public function key():*

Returns the current key of the internal pointer of the iterator (optional operation).

Returns
* — the current key of the internal pointer of the iterator (optional operation).
next()method 
public function next():*

Returns the next element in the iteration.

Returns
* — the next element in the iteration.
remove()method 
public function remove():*

Removes from the underlying collection the last element returned by the iterator (optional operation).

Returns
*
reset()method 
public function reset():void

Reset the internal pointer of the iterator (optional operation).

seek()method 
public function seek(position:*):void

Change the position of the internal pointer of the iterator (optional operation).

Parameters

position:*