string.html
来自「j2se5-api-zh,java文档的中文版本」· HTML 代码 · 共 1,218 行 · 第 1/5 页
HTML
1,218 行
分配一个新的 <code>String</code>,它包含该 Unicode 代码点数组参数的一个子数组的字符。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="String.html#String(java.lang.String)">String</A></B>(<A HREF="String.html" title="java.lang 中的类">String</A> original)</CODE><BR> 初始化一个新创建的 <code>String</code> 对象,表示一个与该参数相同的字符序列;换句话说,新创建的字符串是该参数字符串的一个副本。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="String.html#String(java.lang.StringBuffer)">String</A></B>(<A HREF="StringBuffer.html" title="java.lang 中的类">StringBuffer</A> buffer)</CODE><BR> 分配一个新的字符串,它包含当前包含在字符串缓冲区参数中的字符序列。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="String.html#String(java.lang.StringBuilder)">String</A></B>(<A HREF="StringBuilder.html" title="java.lang 中的类">StringBuilder</A> builder)</CODE><BR> 分配一个新的字符串,它包含当前包含在字符串生成器参数中的字符序列。</TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>方法摘要</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> char</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#charAt(int)">charAt</A></B>(int index)</CODE><BR> 返回指定索引处的 <code>char</code> 值。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#codePointAt(int)">codePointAt</A></B>(int index)</CODE><BR> 返回指定索引处的字符(Unicode 代码点)。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#codePointBefore(int)">codePointBefore</A></B>(int index)</CODE><BR> 返回指定索引之前的字符(Unicode 代码点)。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#codePointCount(int, int)">codePointCount</A></B>(int beginIndex, int endIndex)</CODE><BR> 返回此 <code>String</code> 的指定文本范围中的 Unicode 代码点数。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#compareTo(java.lang.String)">compareTo</A></B>(<A HREF="String.html" title="java.lang 中的类">String</A> anotherString)</CODE><BR> 按字典顺序比较两个字符串。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#compareToIgnoreCase(java.lang.String)">compareToIgnoreCase</A></B>(<A HREF="String.html" title="java.lang 中的类">String</A> str)</CODE><BR> 不考虑大小写,按字典顺序比较两个字符串。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="String.html" title="java.lang 中的类">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="String.html#concat(java.lang.String)">concat</A></B>(<A HREF="String.html" title="java.lang 中的类">String</A> str)</CODE><BR> 将指定字符串联到此字符串的结尾。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#contains(java.lang.CharSequence)">contains</A></B>(<A HREF="CharSequence.html" title="java.lang 中的接口">CharSequence</A> s)</CODE><BR> 当且仅当此字符串包含 char 值的指定序列时,才返回 true。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#contentEquals(java.lang.CharSequence)">contentEquals</A></B>(<A HREF="CharSequence.html" title="java.lang 中的接口">CharSequence</A> cs)</CODE><BR> 当且仅当此 <tt>String</tt> 表示与指定序列相同的 char 值时,才返回 <tt>true</tt>。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#contentEquals(java.lang.StringBuffer)">contentEquals</A></B>(<A HREF="StringBuffer.html" title="java.lang 中的类">StringBuffer</A> sb)</CODE><BR> 当且仅当此 <tt>String</tt> 表示与指定的 <tt>StringBuffer</tt> 相同的字符序列时,才返回 <tt>true</tt>。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="String.html" title="java.lang 中的类">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="String.html#copyValueOf(char[])">copyValueOf</A></B>(char[] data)</CODE><BR> 返回指定数组中表示该字符序列的字符串。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="String.html" title="java.lang 中的类">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="String.html#copyValueOf(char[], int, int)">copyValueOf</A></B>(char[] data, int offset, int count)</CODE><BR> 返回指定数组中表示该字符序列的字符串。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#endsWith(java.lang.String)">endsWith</A></B>(<A HREF="String.html" title="java.lang 中的类">String</A> suffix)</CODE><BR> 测试此字符串是否以指定的后缀结束。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#equals(java.lang.Object)">equals</A></B>(<A HREF="Object.html" title="java.lang 中的类">Object</A> anObject)</CODE><BR> 比较此字符串与指定的对象。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#equalsIgnoreCase(java.lang.String)">equalsIgnoreCase</A></B>(<A HREF="String.html" title="java.lang 中的类">String</A> anotherString)</CODE><BR> 将此 <code>String</code> 与另一个 <code>String</code> 进行比较,不考虑大小写。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="String.html" title="java.lang 中的类">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="String.html#format(java.util.Locale, java.lang.String, java.lang.Object...)">format</A></B>(<A HREF="../util/Locale.html" title="java.util 中的类">Locale</A> l, <A HREF="String.html" title="java.lang 中的类">String</A> format, <A HREF="Object.html" title="java.lang 中的类">Object</A>... args)</CODE><BR> 使用指定的语言环境、格式字符串和参数返回一个格式化字符串。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="String.html" title="java.lang 中的类">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="String.html#format(java.lang.String, java.lang.Object...)">format</A></B>(<A HREF="String.html" title="java.lang 中的类">String</A> format, <A HREF="Object.html" title="java.lang 中的类">Object</A>... args)</CODE><BR> 使用指定的格式字符串和参数返回一个格式化字符串。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> byte[]</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#getBytes()">getBytes</A></B>()</CODE><BR> 使用平台默认的字符集将此 <tt>String</tt> 解码为字节序列,并将结果存储到一个新的字节数组中。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#getBytes(int, int, byte[], int)">getBytes</A></B>(int srcBegin, int srcEnd, byte[] dst, int dstBegin)</CODE><BR> <B>已过时。</B> <I>该方法无法将字符正确转换为字节。从 JDK 1.1 起,完成该转换的首选方法是通过 <code>getBytes()</code> 构造方法,该方法使用平台的默认字符集。</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> byte[]</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#getBytes(java.lang.String)">getBytes</A></B>(<A HREF="String.html" title="java.lang 中的类">String</A> charsetName)</CODE><BR> 使用指定的字符集将此 <tt>String</tt> 解码为字节序列,并将结果存储到一个新的字节数组中。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#getChars(int, int, char[], int)">getChars</A></B>(int srcBegin, int srcEnd, char[] dst, int dstBegin)</CODE><BR> 将字符从此字符串复制到目标字符数组。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#hashCode()">hashCode</A></B>()</CODE><BR> 返回此字符串的哈希代码。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#indexOf(int)">indexOf</A></B>(int ch)</CODE><BR> 返回指定字符在此字符串中第一次出现处的索引。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#indexOf(int, int)">indexOf</A></B>(int ch, int fromIndex)</CODE><BR> 从指定的索引开始搜索,返回在此字符串中第一次出现指定字符处的索引。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="String.html#indexOf(java.lang.String)">indexOf</A></B>(<A HREF="String.html" title="java.lang 中的类">String</A> str)</CODE><BR> 返回第一次出现的指定子字符串在此字符串中的索引。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor">
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?