lastElement()

DtpSplitString オブジェクトの最後のエレメントを戻します。

構文

String lastElement()
 

戻り値

最後のエレメントを含む String を戻します。

例外

DtpNoElementAtPositionException - エレメントがない場合です。

注記

エレメントには、ゼロから始まって、最初から最後まで番号が付けられます。最後のエレメントは、最も番号の大きいエレメントです。最後のエレメントの位置番号は、getElementCount()-1 と同じです。

lastElement() メソッドは、最後のエレメントを戻しますが、現在のエレメントの位置は変更しません。

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

参照項目

firstElement(), getElementCount()

Copyright IBM Corp. 2004