reset()

Resets the current position number in the DtpSplitString object to zero.

Syntax

void reset()
 

Return values

None.

Notes

The default element position is zero. Each time you call nextElement(), the element position increments by one. The prevElement() method returns the previous element and decrements the element position by one. You can use reset() to reset the current position back to zero.

Examples

// Create a DtpSplitString object
 DtpSplitString MyString = new DtpSplitString("This,is a test",", ");
  
 // This call returns element 0 containing "This"
 String firstElement = MyString.nextElement()
  
 // This call returns element 1 containing "is"
 String secondElement = MyString.nextElement()
  
 // Reset the position to zero
 MyString.reset()
  
 // This call returns element 0 containing "This"
 String firstElement = MyString.nextElement()
 

See also

nextElement(), prevElement()

Copyright IBM Corp. 2003