⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 string.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:35:10 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class  String</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_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/String.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/lang/StrictMath.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../java/lang/StringBuffer.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="String.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;<A HREF="#field_summary">FIELD</A>&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;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.lang</FONT><BR>Class  String</H2><PRE><A HREF="../../java/lang/Object.html">java.lang.Object</A>  |  +--<B>java.lang.String</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../java/lang/Comparable.html">Comparable</A>, <A HREF="../../java/io/Serializable.html">Serializable</A></DD></DL><HR><DL><DT>public final class <B>String</B><DT>extends <A HREF="../../java/lang/Object.html">Object</A><DT>implements <A HREF="../../java/io/Serializable.html">Serializable</A>, <A HREF="../../java/lang/Comparable.html">Comparable</A></DL><P>The <code>String</code> class represents character strings. All  string literals in Java programs, such as <code>"abc"</code>, are  implemented as instances of this class.  <p> Strings are constant; their values cannot be changed after they  are created. String buffers support mutable strings. Because String objects are immutable they can be shared. For example: <p><blockquote><pre>     String str = "abc"; </pre></blockquote><p> is equivalent to: <p><blockquote><pre>     char data[] = {'a', 'b', 'c'};     String str = new String(data); </pre></blockquote><p> Here are some more examples of how strings can be used: <p><blockquote><pre>     System.out.println("abc");     String cde = "cde";     System.out.println("abc" + cde);     String c = "abc".substring(2,3);     String d = cde.substring(1, 2); </pre></blockquote> <p> The class <code>String</code> includes methods for examining  individual characters of the sequence, for comparing strings, for  searching strings, for extracting substrings, and for creating a  copy of a string with all characters translated to uppercase or to  lowercase.  <p> The Java language provides special support for the string  concatentation operator (&nbsp;+&nbsp;), and for conversion of  other objects to strings. String concatenation is implemented  through the <code>StringBuffer</code> class and its  <code>append</code> method. String conversions are implemented through the method  <code>toString</code>, defined by <code>Object</code> and  inherited by all classes in Java. For additional information on  string concatenation and conversion, see Gosling, Joy, and Steele,  <i>The Java Language Specification</i>.<P><DL><DT><B>Since: </B><DD>JDK1.0</DD><DT><B>See Also: </B><DD><A HREF="../../java/lang/Object.html#toString()"><CODE>Object.toString()</CODE></A>, <A HREF="../../java/lang/StringBuffer.html"><CODE>StringBuffer</CODE></A>, <A HREF="../../java/lang/StringBuffer.html#append(boolean)"><CODE>StringBuffer.append(boolean)</CODE></A>, <A HREF="../../java/lang/StringBuffer.html#append(char)"><CODE>StringBuffer.append(char)</CODE></A>, <A HREF="../../java/lang/StringBuffer.html#append(char[])"><CODE>StringBuffer.append(char[])</CODE></A>, <A HREF="../../java/lang/StringBuffer.html#append(char[], int, int)"><CODE>StringBuffer.append(char[], int, int)</CODE></A>, <A HREF="../../java/lang/StringBuffer.html#append(double)"><CODE>StringBuffer.append(double)</CODE></A>, <A HREF="../../java/lang/StringBuffer.html#append(float)"><CODE>StringBuffer.append(float)</CODE></A>, <A HREF="../../java/lang/StringBuffer.html#append(int)"><CODE>StringBuffer.append(int)</CODE></A>, <A HREF="../../java/lang/StringBuffer.html#append(long)"><CODE>StringBuffer.append(long)</CODE></A>, <A HREF="../../java/lang/StringBuffer.html#append(java.lang.Object)"><CODE>StringBuffer.append(java.lang.Object)</CODE></A>, <A HREF="../../java/lang/StringBuffer.html#append(java.lang.String)"><CODE>StringBuffer.append(java.lang.String)</CODE></A>, <a href="package-summary.html#charenc">Character encodings</a>, <A HREF="../../serialized-form.html#java.lang.String">Serialized Form</A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;<A HREF="../../java/util/Comparator.html">Comparator</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/String.html#CASE_INSENSITIVE_ORDER">CASE_INSENSITIVE_ORDER</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a Comparator that orders <code>String</code> objects as by <code>compareToIgnoreCase</code>.</TD></TR></TABLE>&nbsp;<!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/lang/String.html#String()">String</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Initializes a newly created <code>String</code> object so that it  represents an empty character sequence.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/lang/String.html#String(byte[])">String</A></B>(byte[]&nbsp;bytes)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Construct a new <code>String</code> by converting the specified array of bytes using the platform's default character encoding.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/lang/String.html#String(byte[], int)">String</A></B>(byte[]&nbsp;ascii,       int&nbsp;hibyte)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>This method does not properly convert bytes into characters. As of JDK&nbsp;1.1, the preferred way to do this is via the <code>String</code> constructors that take a character-encoding name or that use the platform's default encoding.</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/lang/String.html#String(byte[], int, int)">String</A></B>(byte[]&nbsp;bytes,       int&nbsp;offset,       int&nbsp;length)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Construct a new <code>String</code> by converting the specified subarray of bytes using the platform's default character encoding.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/lang/String.html#String(byte[], int, int, int)">String</A></B>(byte[]&nbsp;ascii,       int&nbsp;hibyte,       int&nbsp;offset,       int&nbsp;count)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>This method does not properly convert bytes into characters. As of JDK&nbsp;1.1, the preferred way to do this is via the <code>String</code> constructors that take a character-encoding name or that use the platform's default encoding.</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/lang/String.html#String(byte[], int, int, java.lang.String)">String</A></B>(byte[]&nbsp;bytes,       int&nbsp;offset,       int&nbsp;length,       <A HREF="../../java/lang/String.html">String</A>&nbsp;enc)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Construct a new <code>String</code> by converting the specified subarray of bytes using the specified character encoding.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/lang/String.html#String(byte[], java.lang.String)">String</A></B>(byte[]&nbsp;bytes,       <A HREF="../../java/lang/String.html">String</A>&nbsp;enc)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Construct a new <code>String</code> by converting the specified array of bytes using the specified character encoding.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/lang/String.html#String(char[])">String</A></B>(char[]&nbsp;value)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Allocates a new <code>String</code> so that it represents the  sequence of characters currently contained in the character array  argument.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/lang/String.html#String(char[], int, int)">String</A></B>(char[]&nbsp;value,       int&nbsp;offset,       int&nbsp;count)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Allocates a new <code>String</code> that contains characters from  a subarray of the character array argument.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/lang/String.html#String(java.lang.String)">String</A></B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;value)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Initializes a newly created <code>String</code> object so that it  represents the same sequence of characters as the argument; in other  words, the newly created string is a copy of the argument string.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/lang/String.html#String(java.lang.StringBuffer)">String</A></B>(<A HREF="../../java/lang/StringBuffer.html">StringBuffer</A>&nbsp;buffer)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Allocates a new string that contains the sequence of characters  currently contained in the string buffer argument.</TD></TR></TABLE>&nbsp;<!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -