nextElement()

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

構文

String nextElement()
 

戻り値

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

例外

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

注記

初めて nextElement() を呼び出したときに、位置ゼロのエレメントが戻されます。後続のメソッド呼び出しでは、nextElement() は位置 1、2、3 などのエレメントを戻します。nextElement()prevElement() を使用して、DtpSplitString オブジェクト内のエレメント (トークン) をナビゲートすることもできます。

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

参照項目

prevElement(), reset()

Copyright IBM Corp. 2004