📄 string.html
字号:
Returns a new string resulting from replacing all occurrences of <code>oldChar</code> in this string with <code>newChar</code>.</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="../../java/lang/String.html#startsWith(java.lang.String)">startsWith</A></B>(<A HREF="../../java/lang/String.html">String</A> prefix)</CODE><BR> Tests if this string starts with the specified prefix.</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="../../java/lang/String.html#startsWith(java.lang.String, int)">startsWith</A></B>(<A HREF="../../java/lang/String.html">String</A> prefix, int toffset)</CODE><BR> Tests if this string starts with the specified prefix beginning a specified index.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/String.html#substring(int)">substring</A></B>(int beginIndex)</CODE><BR> Returns a new string that is a substring of this string.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/String.html#substring(int, int)">substring</A></B>(int beginIndex, int endIndex)</CODE><BR> Returns a new string that is a substring of this string.</TD></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="../../java/lang/String.html#toCharArray()">toCharArray</A></B>()</CODE><BR> Converts this string to a new character array.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/String.html#toLowerCase()">toLowerCase</A></B>()</CODE><BR> Converts all of the characters in this <code>String</code> to lower case using the rules of the default locale, which is returned by <code>Locale.getDefault</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/String.html#toLowerCase(java.util.Locale)">toLowerCase</A></B>(<A HREF="../../java/util/Locale.html">Locale</A> locale)</CODE><BR> Converts all of the characters in this <code>String</code> to lower case using the rules of the given <code>Locale</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/String.html#toString()">toString</A></B>()</CODE><BR> This object (which is already a string!) is itself returned.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/String.html#toUpperCase()">toUpperCase</A></B>()</CODE><BR> Converts all of the characters in this <code>String</code> to upper case using the rules of the default locale, which is returned by <code>Locale.getDefault</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/String.html#toUpperCase(java.util.Locale)">toUpperCase</A></B>(<A HREF="../../java/util/Locale.html">Locale</A> locale)</CODE><BR> Converts all of the characters in this <code>String</code> to upper case using the rules of the given locale.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/String.html#trim()">trim</A></B>()</CODE><BR> Removes white space from both ends of this string.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/String.html#valueOf(boolean)">valueOf</A></B>(boolean b)</CODE><BR> Returns the string representation of the <code>boolean</code> argument.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/String.html#valueOf(char)">valueOf</A></B>(char c)</CODE><BR> Returns the string representation of the <code>char</code> argument.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/String.html#valueOf(char[])">valueOf</A></B>(char[] data)</CODE><BR> Returns the string representation of the <code>char</code> array argument.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/String.html#valueOf(char[], int, int)">valueOf</A></B>(char[] data, int offset, int count)</CODE><BR> Returns the string representation of a specific subarray of the <code>char</code> array argument.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/String.html#valueOf(double)">valueOf</A></B>(double d)</CODE><BR> Returns the string representation of the <code>double</code> argument.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/String.html#valueOf(float)">valueOf</A></B>(float f)</CODE><BR> Returns the string representation of the <code>float</code> argument.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/String.html#valueOf(int)">valueOf</A></B>(int i)</CODE><BR> Returns the string representation of the <code>int</code> argument.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/String.html#valueOf(long)">valueOf</A></B>(long l)</CODE><BR> Returns the string representation of the <code>long</code> argument.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/String.html#valueOf(java.lang.Object)">valueOf</A></B>(<A HREF="../../java/lang/Object.html">Object</A> obj)</CODE><BR> Returns the string representation of the <code>Object</code> argument.</TD></TR></TABLE> <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#clone()">clone</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#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</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> <P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD></TR></TABLE><A NAME="CASE_INSENSITIVE_ORDER"><!-- --></A><H3>CASE_INSENSITIVE_ORDER</H3><PRE>public static final <A HREF="../../java/util/Comparator.html">Comparator</A> <B>CASE_INSENSITIVE_ORDER</B></PRE><DL><DD>Returns a Comparator that orders <code>String</code> objects as by <code>compareToIgnoreCase</code>. This comparator is serializable. <p> Note that this Comparator does <em>not</em> take locale into account, and will result in an unsatisfactory ordering for certain locales. The java.text package provides <em>Collators</em> to allow locale-sensitive ordering.<DD><DL><DT><B>See Also: </B><DD><A HREF="../../java/text/Collator.html#compare(java.lang.String, java.lang.String)"><CODE>Collator.compare(String, String)</CODE></A><DT><B>Since: </B><DD>1.2</DD></DL></DD></DL><!-- ========= 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="String()"><!-- --></A><H3>String</H3><PRE>public <B>String</B>()</PRE><DL><DD>Initializes a newly created <code>String</code> object so that it represents an empty character sequence.</DL><HR><A NAME="String(java.lang.String)"><!-- --></A><H3>String</H3><PRE>public <B>String</B>(<A HREF="../../java/lang/String.html">String</A> value)</PRE><DL><DD>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.<DD><DL><DT><B>Parameters:</B><DD><CODE>value</CODE> - a <code>String</code>.</DL></DD></DL><HR><A NAME="String(char[])"><!-- --></A><H3>String</H3><PRE>public <B>String</B>(char[] value)</PRE><DL><DD>Allocates a new <code>String</code> so that it represents the sequence of characters currently contained in the character array argument. The contents of the character array are copied; subsequent modification of the character array does not affect the newly created string.<DD><DL><DT><B>Parameters:</B><DD><CODE>value</CODE> - the initial value of the string.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>value</code> is <code>null</code>.</DL></DD></DL><HR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -