firstElement()

Returns the element in the DtpSplitString object at position zero.

Syntax

String firstElement()
 

Return values

Returns a String containing the element at position zero.

Exceptions

DtpNoElementAtPositionException - If there are no elements.

Notes

Elements in the DtpSplitString object are numbered from first to last beginning with zero. Therefore, the first element is at position zero.

The firstElement() method returns the element at position zero but does not change the current element position.

Examples

// Create a DtpSplitString object
 DtpSplitString MyString = new DtpSplitString("This,is a test",", ");
  
 // This call returns the first element containing "This"
 String anElement = MyString.firstElement();
 

See also

lastElement()

Copyright IBM Corp. 2003