📄 stringtokenizer.html
字号:
<P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="StringTokenizer(java.lang.String, java.lang.String, boolean)"><!-- --></A><H3>StringTokenizer</H3><PRE>public <B>StringTokenizer</B>(<A HREF="../../java/lang/String.html">String</A> str, <A HREF="../../java/lang/String.html">String</A> delim, boolean returnDelims)</PRE><DL><DD>Constructs a string tokenizer for the specified string. All characters in the <code>delim</code> argument are the delimiters for separating tokens. <p> If the <code>returnDelims</code> flag is <code>true</code>, then the delimiter characters are also returned as tokens. Each delimiter is returned as a string of length one. If the flag is <code>false</code>, the delimiter characters are skipped and only serve as separators between tokens.<DD><DL><DT><B>Parameters:</B><DD><CODE>str</CODE> - a string to be parsed.<DD><CODE>delim</CODE> - the delimiters.<DD><CODE>returnDelims</CODE> - flag indicating whether to return the delimiters as tokens.</DL></DD></DL><HR><A NAME="StringTokenizer(java.lang.String, java.lang.String)"><!-- --></A><H3>StringTokenizer</H3><PRE>public <B>StringTokenizer</B>(<A HREF="../../java/lang/String.html">String</A> str, <A HREF="../../java/lang/String.html">String</A> delim)</PRE><DL><DD>Constructs a string tokenizer for the specified string. The characters in the <code>delim</code> argument are the delimiters for separating tokens. Delimiter characters themselves will not be treated as tokens.<DD><DL><DT><B>Parameters:</B><DD><CODE>str</CODE> - a string to be parsed.<DD><CODE>delim</CODE> - the delimiters.</DL></DD></DL><HR><A NAME="StringTokenizer(java.lang.String)"><!-- --></A><H3>StringTokenizer</H3><PRE>public <B>StringTokenizer</B>(<A HREF="../../java/lang/String.html">String</A> str)</PRE><DL><DD>Constructs a string tokenizer for the specified string. The tokenizer uses the default delimiter set, which is <code>" \t\n\r\f"</code>: the space character, the tab character, the newline character, the carriage-return character, and the form-feed character. Delimiter characters themselves will not be treated as tokens.<DD><DL><DT><B>Parameters:</B><DD><CODE>str</CODE> - a string to be parsed.</DL></DD></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="hasMoreTokens()"><!-- --></A><H3>hasMoreTokens</H3><PRE>public boolean <B>hasMoreTokens</B>()</PRE><DL><DD>Tests if there are more tokens available from this tokenizer's string. If this method returns <tt>true</tt>, then a subsequent call to <tt>nextToken</tt> with no argument will successfully return a token.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD><code>true</code> if and only if there is at least one token in the string after the current position; <code>false</code> otherwise.</DL></DD></DL><HR><A NAME="nextToken()"><!-- --></A><H3>nextToken</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>nextToken</B>()</PRE><DL><DD>Returns the next token from this string tokenizer.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the next token from this string tokenizer.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/util/NoSuchElementException.html">NoSuchElementException</A></CODE> - if there are no more tokens in this tokenizer's string.</DL></DD></DL><HR><A NAME="nextToken(java.lang.String)"><!-- --></A><H3>nextToken</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>nextToken</B>(<A HREF="../../java/lang/String.html">String</A> delim)</PRE><DL><DD>Returns the next token in this string tokenizer's string. First, the set of characters considered to be delimiters by this <tt>StringTokenizer</tt> object is changed to be the characters in the string <tt>delim</tt>. Then the next token in the string after the current position is returned. The current position is advanced beyond the recognized token. The new delimiter set remains the default after this call.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>delim</CODE> - the new delimiters.<DT><B>Returns:</B><DD>the next token, after switching to the new delimiter set.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/util/NoSuchElementException.html">NoSuchElementException</A></CODE> - if there are no more tokens in this tokenizer's string.</DL></DD></DL><HR><A NAME="hasMoreElements()"><!-- --></A><H3>hasMoreElements</H3><PRE>public boolean <B>hasMoreElements</B>()</PRE><DL><DD>Returns the same value as the <code>hasMoreTokens</code> method. It exists so that this class can implement the <code>Enumeration</code> interface.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Enumeration.html#hasMoreElements()">hasMoreElements</A></CODE> in interface <CODE><A HREF="../../java/util/Enumeration.html">Enumeration</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD><code>true</code> if there are more tokens; <code>false</code> otherwise.<DT><B>See Also: </B><DD><A HREF="../../java/util/Enumeration.html"><CODE>Enumeration</CODE></A>, <A HREF="../../java/util/StringTokenizer.html#hasMoreTokens()"><CODE>hasMoreTokens()</CODE></A></DL></DD></DL><HR><A NAME="nextElement()"><!-- --></A><H3>nextElement</H3><PRE>public <A HREF="../../java/lang/Object.html">Object</A> <B>nextElement</B>()</PRE><DL><DD>Returns the same value as the <code>nextToken</code> method, except that its declared return value is <code>Object</code> rather than <code>String</code>. It exists so that this class can implement the <code>Enumeration</code> interface.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Enumeration.html#nextElement()">nextElement</A></CODE> in interface <CODE><A HREF="../../java/util/Enumeration.html">Enumeration</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the next token in the string.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/util/NoSuchElementException.html">NoSuchElementException</A></CODE> - if there are no more tokens in this tokenizer's string.<DT><B>See Also: </B><DD><A HREF="../../java/util/Enumeration.html"><CODE>Enumeration</CODE></A>, <A HREF="../../java/util/StringTokenizer.html#nextToken()"><CODE>nextToken()</CODE></A></DL></DD></DL><HR><A NAME="countTokens()"><!-- --></A><H3>countTokens</H3><PRE>public int <B>countTokens</B>()</PRE><DL><DD>Calculates the number of times that this tokenizer's <code>nextToken</code> method can be called before it generates an exception. The current position is not advanced.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the number of tokens remaining in the string using the current delimiter set.<DT><B>See Also: </B><DD><A HREF="../../java/util/StringTokenizer.html#nextToken()"><CODE>nextToken()</CODE></A></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/StringTokenizer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../java/util/Stack.html"><B>PREV CLASS</B></A> <A HREF="../../java/util/Timer.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="StringTokenizer.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -