format.html

来自「API資料大全」· HTML 代码 · 共 442 行 · 第 1/2 页

HTML
442
字号
</TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract &nbsp;<A HREF="../../java/lang/Object.html">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/text/Format.html#parseObject(java.lang.String, java.text.ParsePosition)">parseObject</A></B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;source,            <A HREF="../../java/text/ParsePosition.html">ParsePosition</A>&nbsp;status)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Parses a string to produce an object.</TD></TR></TABLE>&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html">Object</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../java/lang/Object.html#finalize()">finalize</A>, <A HREF="../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../java/lang/Object.html#toString()">toString</A>, <A HREF="../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD></TR></TABLE>&nbsp;<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="Format()"><!-- --></A><H3>Format</H3><PRE>public <B>Format</B>()</PRE><DL></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="format(java.lang.Object)"><!-- --></A><H3>format</H3><PRE>public final <A HREF="../../java/lang/String.html">String</A> <B>format</B>(<A HREF="../../java/lang/Object.html">Object</A>&nbsp;obj)</PRE><DL><DD>Formats an object to produce a string. <p>Subclasses will override the StringBuffer version of format.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>obj</CODE> - The object to format<DT><B>Returns:</B><DD>Formatted string.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - when the Format cannot format the type of object.<DT><B>See Also: </B><DD><A HREF="../../java/text/MessageFormat.html"><CODE>MessageFormat</CODE></A>, <A HREF="../../java/text/Format.html#format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)"><CODE>format(Object, StringBuffer, FieldPosition)</CODE></A></DL></DD></DL><HR><A NAME="format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)"><!-- --></A><H3>format</H3><PRE>public abstract <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A> <B>format</B>(<A HREF="../../java/lang/Object.html">Object</A>&nbsp;obj,                                    <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A>&nbsp;toAppendTo,                                    <A HREF="../../java/text/FieldPosition.html">FieldPosition</A>&nbsp;pos)</PRE><DL><DD>Formats an object to produce a string. Subclasses will implement for particular object, such as: <pre> StringBuffer format (Number obj, StringBuffer toAppendTo) Number parse (String str) </pre> These general routines allow polymorphic parsing and formatting for objects such as the MessageFormat.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>obj</CODE> - The object to format<DD><CODE>toAppendTo</CODE> - where the text is to be appended<DD><CODE>pos</CODE> - On input: an alignment field, if desired. On output: the offsets of the alignment field.<DT><B>Returns:</B><DD>the value passed in as toAppendTo (this allows chaining, as with StringBuffer.append())<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - when the Format cannot format the given object.<DT><B>See Also: </B><DD><A HREF="../../java/text/MessageFormat.html"><CODE>MessageFormat</CODE></A>, <A HREF="../../java/text/FieldPosition.html"><CODE>FieldPosition</CODE></A></DL></DD></DL><HR><A NAME="parseObject(java.lang.String, java.text.ParsePosition)"><!-- --></A><H3>parseObject</H3><PRE>public abstract <A HREF="../../java/lang/Object.html">Object</A> <B>parseObject</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;source,                                   <A HREF="../../java/text/ParsePosition.html">ParsePosition</A>&nbsp;status)</PRE><DL><DD>Parses a string to produce an object. Subclasses will typically implement for particular object, such as: <pre>       String format (Number obj);       String format (long obj);       String format (double obj);       Number parse (String str); </pre><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>status</CODE> - Input-Output parameter. <p>Before calling, set status.index to the offset you want to start parsing at in the source. After calling, status.index is the end of the text you parsed. If error occurs, index is unchanged. <p>When parsing, leading whitespace is discarded (with successful parse), while trailing whitespace is left as is. <p>Example: Parsing "_12_xy" (where _ represents a space) for a number, with index == 0 will result in the number 12, with status.index updated to 3 (just before the second space). Parsing a second time will result in a ParseException since "xy" is not a number, and leave index at 3. <p>Subclasses will typically supply specific parse methods that return different types of values. Since methods can't overload on return types, these will typically be named "parse", while this polymorphic method will always be called parseObject. Any parse method that does not take a status should throw ParseException when no text in the required format is at the start position.<DT><B>Returns:</B><DD>Object parsed from string. In case of error, returns null.<DT><B>See Also: </B><DD><A HREF="../../java/text/ParsePosition.html"><CODE>ParsePosition</CODE></A></DL></DD></DL><HR><A NAME="parseObject(java.lang.String)"><!-- --></A><H3>parseObject</H3><PRE>public <A HREF="../../java/lang/Object.html">Object</A> <B>parseObject</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;source)                   throws <A HREF="../../java/text/ParseException.html">ParseException</A></PRE><DL><DD>Parses a string to produce an object.<DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../java/text/ParseException.html">ParseException</A></CODE> - if the specified string is invalid.</DL></DD></DL><HR><A NAME="clone()"><!-- --></A><H3>clone</H3><PRE>public <A HREF="../../java/lang/Object.html">Object</A> <B>clone</B>()</PRE><DL><DD>Overrides Cloneable<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#clone()">clone</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL></DD><DD>Following copied from class: <CODE>java.lang.Object</CODE></DD><DD><DL><DT><B>Returns:</B><DD>a clone of this instance.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/CloneNotSupportedException.html">CloneNotSupportedException</A></CODE> - if the object's class does not               support the <code>Cloneable</code> interface. Subclasses               that override the <code>clone</code> method can also               throw this exception to indicate that an instance cannot               be cloned.<DD><CODE><A HREF="../../java/lang/OutOfMemoryError.html">OutOfMemoryError</A></CODE> - if there is not enough memory.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Cloneable.html"><CODE>Cloneable</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>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Format.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Std.&nbsp;Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../java/text/FieldPosition.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../java/text/MessageFormat.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>  &nbsp;&nbsp;<A HREF="Format.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<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 + =
减小字号Ctrl + -
显示快捷键?