nextElement()

Returns the next element in the DtpSplitString object.

Syntax

String nextElement()
 

Return values

Returns a String containing the next element.

Exceptions

DtpNoElementAtPositionException - If there is no next element.

Notes

The first time you call nextElement(), it returns the element at position zero. In subsequent method calls, nextElement() returns the element at position one, two, three, and so on. You can use nextElement(), along with prevElement(), to navigate the elements (tokens) in a DtpSplitString object.

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()
 

See also

prevElement(), reset()

Copyright IBM Corp. 1997, 2003