firstElement()

位置ゼロの DtpSplitString オブジェクトのエレメントを戻します。

構文

String firstElement()
 

戻り値

位置ゼロのエレメントを含む String を戻します。

例外

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

注記

DtpSplitString オブジェクトのエレメントには、ゼロから始まって、最初から最後まで番号が付けられます。したがって、最初のエレメントの位置はゼロです。

firstElement() メソッドは、位置ゼロのエレメントを戻しますが、現在のエレメントの位置は変更しません

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

参照項目

lastElement()

Copyright IBM Corp. 2004