mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-10 09:39:37 +07:00
3545 lines
177 KiB
HTML
3545 lines
177 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<!--NewPage-->
|
|
<HTML>
|
|
<HEAD>
|
|
<!-- Generated by javadoc (build 1.6.0_27) on Wed Aug 10 15:58:01 PDT 2011 -->
|
|
<TITLE>
|
|
String (Java Platform SE 6)
|
|
</TITLE>
|
|
|
|
<META NAME="date" CONTENT="2011-08-10">
|
|
<META NAME="keywords" CONTENT="java.lang.String class">
|
|
<META NAME="keywords" CONTENT="CASE_INSENSITIVE_ORDER">
|
|
<META NAME="keywords" CONTENT="length()">
|
|
<META NAME="keywords" CONTENT="isEmpty()">
|
|
<META NAME="keywords" CONTENT="charAt()">
|
|
<META NAME="keywords" CONTENT="codePointAt()">
|
|
<META NAME="keywords" CONTENT="codePointBefore()">
|
|
<META NAME="keywords" CONTENT="codePointCount()">
|
|
<META NAME="keywords" CONTENT="offsetByCodePoints()">
|
|
<META NAME="keywords" CONTENT="getChars()">
|
|
<META NAME="keywords" CONTENT="getBytes()">
|
|
<META NAME="keywords" CONTENT="equals()">
|
|
<META NAME="keywords" CONTENT="contentEquals()">
|
|
<META NAME="keywords" CONTENT="equalsIgnoreCase()">
|
|
<META NAME="keywords" CONTENT="compareTo()">
|
|
<META NAME="keywords" CONTENT="compareToIgnoreCase()">
|
|
<META NAME="keywords" CONTENT="regionMatches()">
|
|
<META NAME="keywords" CONTENT="startsWith()">
|
|
<META NAME="keywords" CONTENT="endsWith()">
|
|
<META NAME="keywords" CONTENT="hashCode()">
|
|
<META NAME="keywords" CONTENT="indexOf()">
|
|
<META NAME="keywords" CONTENT="lastIndexOf()">
|
|
<META NAME="keywords" CONTENT="substring()">
|
|
<META NAME="keywords" CONTENT="subSequence()">
|
|
<META NAME="keywords" CONTENT="concat()">
|
|
<META NAME="keywords" CONTENT="replace()">
|
|
<META NAME="keywords" CONTENT="matches()">
|
|
<META NAME="keywords" CONTENT="contains()">
|
|
<META NAME="keywords" CONTENT="replaceFirst()">
|
|
<META NAME="keywords" CONTENT="replaceAll()">
|
|
<META NAME="keywords" CONTENT="split()">
|
|
<META NAME="keywords" CONTENT="toLowerCase()">
|
|
<META NAME="keywords" CONTENT="toUpperCase()">
|
|
<META NAME="keywords" CONTENT="trim()">
|
|
<META NAME="keywords" CONTENT="toString()">
|
|
<META NAME="keywords" CONTENT="toCharArray()">
|
|
<META NAME="keywords" CONTENT="format()">
|
|
<META NAME="keywords" CONTENT="valueOf()">
|
|
<META NAME="keywords" CONTENT="copyValueOf()">
|
|
<META NAME="keywords" CONTENT="intern()">
|
|
|
|
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
|
|
|
|
<SCRIPT type="text/javascript">
|
|
function windowTitle()
|
|
{
|
|
if (location.href.indexOf('is-external=true') == -1) {
|
|
parent.document.title="String (Java Platform SE 6)";
|
|
}
|
|
}
|
|
</SCRIPT>
|
|
<NOSCRIPT>
|
|
</NOSCRIPT>
|
|
|
|
</HEAD>
|
|
|
|
<BODY BGCOLOR="white" onload="windowTitle();">
|
|
<HR>
|
|
|
|
|
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
|
<A NAME="navbar_top"><!-- --></A>
|
|
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
|
|
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
|
<TR>
|
|
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
|
<A NAME="navbar_top_firstrow"><!-- --></A>
|
|
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
|
<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/String.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™ Platform<br>Standard Ed. 6</b></EM>
|
|
</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../java/lang/StrictMath.html" title="class in java.lang"><B>PREV CLASS</B></A>
|
|
<A HREF="../../java/lang/StringBuffer.html" title="class in java.lang"><B>NEXT CLASS</B></A></FONT></TD>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../index.html?java/lang/String.html" target="_top"><B>FRAMES</B></A>
|
|
<A HREF="String.html" target="_top"><B>NO FRAMES</B></A>
|
|
<SCRIPT type="text/javascript">
|
|
<!--
|
|
if(window==top) {
|
|
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
|
|
}
|
|
//-->
|
|
</SCRIPT>
|
|
<NOSCRIPT>
|
|
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
|
|
</NOSCRIPT>
|
|
|
|
|
|
</FONT></TD>
|
|
</TR>
|
|
<TR>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
|
|
</TR>
|
|
</TABLE>
|
|
<A NAME="skip-navbar_top"></A>
|
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
|
|
|
<HR>
|
|
<!-- ======== START OF CLASS DATA ======== -->
|
|
<H2>
|
|
<FONT SIZE="-1">
|
|
java.lang</FONT>
|
|
<BR>
|
|
Class String</H2>
|
|
<PRE>
|
|
<A HREF="../../java/lang/Object.html" title="class in java.lang">java.lang.Object</A>
|
|
<IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>java.lang.String</B>
|
|
</PRE>
|
|
<DL>
|
|
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../java/io/Serializable.html" title="interface in java.io">Serializable</A>, <A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A>, <A HREF="../../java/lang/Comparable.html" title="interface in java.lang">Comparable</A><<A HREF="../../java/lang/String.html" title="class in java.lang">String</A>></DD>
|
|
</DL>
|
|
<HR>
|
|
<DL>
|
|
<DT><PRE>public final class <B>String</B><DT>extends <A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A><DT>implements <A HREF="../../java/io/Serializable.html" title="interface in java.io">Serializable</A>, <A HREF="../../java/lang/Comparable.html" title="interface in java.lang">Comparable</A><<A HREF="../../java/lang/String.html" title="class in java.lang">String</A>>, <A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A></DL>
|
|
</PRE>
|
|
|
|
<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. Case mapping is based on the Unicode Standard version
|
|
specified by the <A HREF="../../java/lang/Character.html" title="class in java.lang"><CODE>Character</CODE></A> class.
|
|
<p>
|
|
The Java language provides special support for the string
|
|
concatenation operator ( + ), and for conversion of
|
|
other objects to strings. String concatenation is implemented
|
|
through the <code>StringBuilder</code>(or <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> Unless otherwise noted, passing a <tt>null</tt> argument to a constructor
|
|
or method in this class will cause a <A HREF="../../java/lang/NullPointerException.html" title="class in java.lang"><CODE>NullPointerException</CODE></A> to be
|
|
thrown.
|
|
|
|
<p>A <code>String</code> represents a string in the UTF-16 format
|
|
in which <em>supplementary characters</em> are represented by <em>surrogate
|
|
pairs</em> (see the section <a href="Character.html#unicode">Unicode
|
|
Character Representations</a> in the <code>Character</code> class for
|
|
more information).
|
|
Index values refer to <code>char</code> code units, so a supplementary
|
|
character uses two positions in a <code>String</code>.
|
|
<p>The <code>String</code> class provides methods for dealing with
|
|
Unicode code points (i.e., characters), in addition to those for
|
|
dealing with Unicode code units (i.e., <code>char</code> values).
|
|
<P>
|
|
|
|
<P>
|
|
<DL>
|
|
<DT><B>Since:</B></DT>
|
|
<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" title="class in java.lang"><CODE>StringBuffer</CODE></A>,
|
|
<A HREF="../../java/lang/StringBuilder.html" title="class in java.lang"><CODE>StringBuilder</CODE></A>,
|
|
<A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset"><CODE>Charset</CODE></A>,
|
|
<A HREF="../../serialized-form.html#java.lang.String">Serialized Form</A></DL>
|
|
<HR>
|
|
|
|
<P>
|
|
<!-- =========== FIELD SUMMARY =========== -->
|
|
|
|
<A NAME="field_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>Field Summary</B></FONT></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE>static <A HREF="../../java/util/Comparator.html" title="interface in java.util">Comparator</A><<A HREF="../../java/lang/String.html" title="class in java.lang">String</A>></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#CASE_INSENSITIVE_ORDER">CASE_INSENSITIVE_ORDER</A></B></CODE>
|
|
|
|
<BR>
|
|
A Comparator that orders <code>String</code> objects as by
|
|
<code>compareToIgnoreCase</code>.</TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
|
|
|
<A NAME="constructor_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>Constructor Summary</B></FONT></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#String()">String</A></B>()</CODE>
|
|
|
|
<BR>
|
|
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[] bytes)</CODE>
|
|
|
|
<BR>
|
|
Constructs a new <code>String</code> by decoding the specified array of bytes
|
|
using the platform's default charset.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#String(byte[], java.nio.charset.Charset)">String</A></B>(byte[] bytes,
|
|
<A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">Charset</A> charset)</CODE>
|
|
|
|
<BR>
|
|
Constructs a new <code>String</code> by decoding the specified array of
|
|
bytes using the specified <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#String(byte[], int)">String</A></B>(byte[] ascii,
|
|
int hibyte)</CODE>
|
|
|
|
<BR>
|
|
<B>Deprecated.</B> <I>This method does not properly convert bytes into
|
|
characters. As of JDK 1.1, the preferred way to do this is via the
|
|
<code>String</code> constructors that take a <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset"><CODE>Charset</CODE></A>, charset name, or that use the platform's
|
|
default charset.</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[] bytes,
|
|
int offset,
|
|
int length)</CODE>
|
|
|
|
<BR>
|
|
Constructs a new <code>String</code> by decoding the specified subarray of
|
|
bytes using the platform's default charset.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#String(byte[], int, int, java.nio.charset.Charset)">String</A></B>(byte[] bytes,
|
|
int offset,
|
|
int length,
|
|
<A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">Charset</A> charset)</CODE>
|
|
|
|
<BR>
|
|
Constructs a new <code>String</code> by decoding the specified subarray of
|
|
bytes using the specified <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>.</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[] ascii,
|
|
int hibyte,
|
|
int offset,
|
|
int count)</CODE>
|
|
|
|
<BR>
|
|
<B>Deprecated.</B> <I>This method does not properly convert bytes into characters.
|
|
As of JDK 1.1, the preferred way to do this is via the
|
|
<code>String</code> constructors that take a <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset"><CODE>Charset</CODE></A>, charset name, or that use the platform's
|
|
default charset.</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[] bytes,
|
|
int offset,
|
|
int length,
|
|
<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> charsetName)</CODE>
|
|
|
|
<BR>
|
|
Constructs a new <code>String</code> by decoding the specified subarray of
|
|
bytes using the specified charset.</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[] bytes,
|
|
<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> charsetName)</CODE>
|
|
|
|
<BR>
|
|
Constructs a new <code>String</code> by decoding the specified array of bytes
|
|
using the specified <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#String(char[])">String</A></B>(char[] value)</CODE>
|
|
|
|
<BR>
|
|
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[] value,
|
|
int offset,
|
|
int count)</CODE>
|
|
|
|
<BR>
|
|
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(int[], int, int)">String</A></B>(int[] codePoints,
|
|
int offset,
|
|
int count)</CODE>
|
|
|
|
<BR>
|
|
Allocates a new <code>String</code> that contains characters from a subarray
|
|
of the Unicode code point 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" title="class in java.lang">String</A> original)</CODE>
|
|
|
|
<BR>
|
|
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" title="class in java.lang">StringBuffer</A> buffer)</CODE>
|
|
|
|
<BR>
|
|
Allocates a new string that contains the sequence of characters
|
|
currently contained in the string buffer argument.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#String(java.lang.StringBuilder)">String</A></B>(<A HREF="../../java/lang/StringBuilder.html" title="class in java.lang">StringBuilder</A> builder)</CODE>
|
|
|
|
<BR>
|
|
Allocates a new string that contains the sequence of characters
|
|
currently contained in the string builder argument.</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>Method Summary</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="../../java/lang/String.html#charAt(int)">charAt</A></B>(int index)</CODE>
|
|
|
|
<BR>
|
|
Returns the <code>char</code> value at the
|
|
specified index.</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="../../java/lang/String.html#codePointAt(int)">codePointAt</A></B>(int index)</CODE>
|
|
|
|
<BR>
|
|
Returns the character (Unicode code point) at the specified
|
|
index.</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="../../java/lang/String.html#codePointBefore(int)">codePointBefore</A></B>(int index)</CODE>
|
|
|
|
<BR>
|
|
Returns the character (Unicode code point) before the specified
|
|
index.</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="../../java/lang/String.html#codePointCount(int, int)">codePointCount</A></B>(int beginIndex,
|
|
int endIndex)</CODE>
|
|
|
|
<BR>
|
|
Returns the number of Unicode code points in the specified text
|
|
range of this <code>String</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="../../java/lang/String.html#compareTo(java.lang.String)">compareTo</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> anotherString)</CODE>
|
|
|
|
<BR>
|
|
Compares two strings lexicographically.</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="../../java/lang/String.html#compareToIgnoreCase(java.lang.String)">compareToIgnoreCase</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str)</CODE>
|
|
|
|
<BR>
|
|
Compares two strings lexicographically, ignoring case
|
|
differences.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#concat(java.lang.String)">concat</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str)</CODE>
|
|
|
|
<BR>
|
|
Concatenates the specified string to the end of this string.</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#contains(java.lang.CharSequence)">contains</A></B>(<A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A> s)</CODE>
|
|
|
|
<BR>
|
|
Returns true if and only if this string contains the specified
|
|
sequence of char values.</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#contentEquals(java.lang.CharSequence)">contentEquals</A></B>(<A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A> cs)</CODE>
|
|
|
|
<BR>
|
|
Compares this string to the specified <code>CharSequence</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#contentEquals(java.lang.StringBuffer)">contentEquals</A></B>(<A HREF="../../java/lang/StringBuffer.html" title="class in java.lang">StringBuffer</A> sb)</CODE>
|
|
|
|
<BR>
|
|
Compares this string to the specified <code>StringBuffer</code>.</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" title="class in java.lang">String</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#copyValueOf(char[])">copyValueOf</A></B>(char[] data)</CODE>
|
|
|
|
<BR>
|
|
Returns a String that represents the character sequence in the
|
|
array specified.</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" title="class in java.lang">String</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#copyValueOf(char[], int, int)">copyValueOf</A></B>(char[] data,
|
|
int offset,
|
|
int count)</CODE>
|
|
|
|
<BR>
|
|
Returns a String that represents the character sequence in the
|
|
array specified.</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#endsWith(java.lang.String)">endsWith</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> suffix)</CODE>
|
|
|
|
<BR>
|
|
Tests if this string ends with the specified suffix.</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#equals(java.lang.Object)">equals</A></B>(<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A> anObject)</CODE>
|
|
|
|
<BR>
|
|
Compares this string to the specified object.</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#equalsIgnoreCase(java.lang.String)">equalsIgnoreCase</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> anotherString)</CODE>
|
|
|
|
<BR>
|
|
Compares this <code>String</code> to another <code>String</code>, ignoring case
|
|
considerations.</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" title="class in java.lang">String</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#format(java.util.Locale, java.lang.String, java.lang.Object...)">format</A></B>(<A HREF="../../java/util/Locale.html" title="class in java.util">Locale</A> l,
|
|
<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> format,
|
|
<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A>... args)</CODE>
|
|
|
|
<BR>
|
|
Returns a formatted string using the specified locale, format string,
|
|
and arguments.</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" title="class in java.lang">String</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#format(java.lang.String, java.lang.Object...)">format</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> format,
|
|
<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A>... args)</CODE>
|
|
|
|
<BR>
|
|
Returns a formatted string using the specified format string and
|
|
arguments.</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="../../java/lang/String.html#getBytes()">getBytes</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Encodes this <code>String</code> into a sequence of bytes using the
|
|
platform's default charset, storing the result into a new byte array.</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="../../java/lang/String.html#getBytes(java.nio.charset.Charset)">getBytes</A></B>(<A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">Charset</A> charset)</CODE>
|
|
|
|
<BR>
|
|
Encodes this <code>String</code> into a sequence of bytes using the given
|
|
<A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>, storing the result into a
|
|
new byte array.</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="../../java/lang/String.html#getBytes(int, int, byte[], int)">getBytes</A></B>(int srcBegin,
|
|
int srcEnd,
|
|
byte[] dst,
|
|
int dstBegin)</CODE>
|
|
|
|
<BR>
|
|
<B>Deprecated.</B> <I>This method does not properly convert characters into
|
|
bytes. As of JDK 1.1, the preferred way to do this is via the
|
|
<A HREF="../../java/lang/String.html#getBytes()"><CODE>getBytes()</CODE></A> method, which uses the platform's default charset.</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="../../java/lang/String.html#getBytes(java.lang.String)">getBytes</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> charsetName)</CODE>
|
|
|
|
<BR>
|
|
Encodes this <code>String</code> into a sequence of bytes using the named
|
|
charset, storing the result into a new byte array.</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="../../java/lang/String.html#getChars(int, int, char[], int)">getChars</A></B>(int srcBegin,
|
|
int srcEnd,
|
|
char[] dst,
|
|
int dstBegin)</CODE>
|
|
|
|
<BR>
|
|
Copies characters from this string into the destination character
|
|
array.</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="../../java/lang/String.html#hashCode()">hashCode</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Returns a hash code for this string.</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="../../java/lang/String.html#indexOf(int)">indexOf</A></B>(int ch)</CODE>
|
|
|
|
<BR>
|
|
Returns the index within this string of the first occurrence of
|
|
the specified character.</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="../../java/lang/String.html#indexOf(int, int)">indexOf</A></B>(int ch,
|
|
int fromIndex)</CODE>
|
|
|
|
<BR>
|
|
Returns the index within this string of the first occurrence of the
|
|
specified character, starting the search at the specified index.</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="../../java/lang/String.html#indexOf(java.lang.String)">indexOf</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str)</CODE>
|
|
|
|
<BR>
|
|
Returns the index within this string of the first occurrence of the
|
|
specified substring.</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="../../java/lang/String.html#indexOf(java.lang.String, int)">indexOf</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str,
|
|
int fromIndex)</CODE>
|
|
|
|
<BR>
|
|
Returns the index within this string of the first occurrence of the
|
|
specified substring, starting at the 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" title="class in java.lang">String</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#intern()">intern</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Returns a canonical representation for the string object.</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#isEmpty()">isEmpty</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Returns <tt>true</tt> if, and only if, <A HREF="../../java/lang/String.html#length()"><CODE>length()</CODE></A> is <tt>0</tt>.</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="../../java/lang/String.html#lastIndexOf(int)">lastIndexOf</A></B>(int ch)</CODE>
|
|
|
|
<BR>
|
|
Returns the index within this string of the last occurrence of
|
|
the specified character.</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="../../java/lang/String.html#lastIndexOf(int, int)">lastIndexOf</A></B>(int ch,
|
|
int fromIndex)</CODE>
|
|
|
|
<BR>
|
|
Returns the index within this string of the last occurrence of
|
|
the specified character, searching backward starting at the
|
|
specified index.</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="../../java/lang/String.html#lastIndexOf(java.lang.String)">lastIndexOf</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str)</CODE>
|
|
|
|
<BR>
|
|
Returns the index within this string of the rightmost occurrence
|
|
of the specified substring.</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="../../java/lang/String.html#lastIndexOf(java.lang.String, int)">lastIndexOf</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str,
|
|
int fromIndex)</CODE>
|
|
|
|
<BR>
|
|
Returns the index within this string of the last occurrence of the
|
|
specified substring, searching backward starting at the specified index.</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="../../java/lang/String.html#length()">length</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Returns the length of this string.</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#matches(java.lang.String)">matches</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex)</CODE>
|
|
|
|
<BR>
|
|
Tells whether or not this string matches the given <a
|
|
href="../util/regex/Pattern.html#sum">regular expression</a>.</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="../../java/lang/String.html#offsetByCodePoints(int, int)">offsetByCodePoints</A></B>(int index,
|
|
int codePointOffset)</CODE>
|
|
|
|
<BR>
|
|
Returns the index within this <code>String</code> that is
|
|
offset from the given <code>index</code> by
|
|
<code>codePointOffset</code> code points.</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#regionMatches(boolean, int, java.lang.String, int, int)">regionMatches</A></B>(boolean ignoreCase,
|
|
int toffset,
|
|
<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> other,
|
|
int ooffset,
|
|
int len)</CODE>
|
|
|
|
<BR>
|
|
Tests if two string regions are equal.</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#regionMatches(int, java.lang.String, int, int)">regionMatches</A></B>(int toffset,
|
|
<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> other,
|
|
int ooffset,
|
|
int len)</CODE>
|
|
|
|
<BR>
|
|
Tests if two string regions are equal.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#replace(char, char)">replace</A></B>(char oldChar,
|
|
char newChar)</CODE>
|
|
|
|
<BR>
|
|
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> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#replace(java.lang.CharSequence, java.lang.CharSequence)">replace</A></B>(<A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A> target,
|
|
<A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A> replacement)</CODE>
|
|
|
|
<BR>
|
|
Replaces each substring of this string that matches the literal target
|
|
sequence with the specified literal replacement sequence.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#replaceAll(java.lang.String, java.lang.String)">replaceAll</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex,
|
|
<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> replacement)</CODE>
|
|
|
|
<BR>
|
|
Replaces each substring of this string that matches the given <a
|
|
href="../util/regex/Pattern.html#sum">regular expression</a> with the
|
|
given replacement.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#replaceFirst(java.lang.String, java.lang.String)">replaceFirst</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex,
|
|
<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> replacement)</CODE>
|
|
|
|
<BR>
|
|
Replaces the first substring of this string that matches the given <a
|
|
href="../util/regex/Pattern.html#sum">regular expression</a> with the
|
|
given replacement.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A>[]</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#split(java.lang.String)">split</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex)</CODE>
|
|
|
|
<BR>
|
|
Splits this string around matches of the given <a
|
|
href="../util/regex/Pattern.html#sum">regular expression</a>.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A>[]</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#split(java.lang.String, int)">split</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex,
|
|
int limit)</CODE>
|
|
|
|
<BR>
|
|
Splits this string around matches of the given
|
|
<a href="../util/regex/Pattern.html#sum">regular expression</a>.</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" title="class in java.lang">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" title="class in java.lang">String</A> prefix,
|
|
int toffset)</CODE>
|
|
|
|
<BR>
|
|
Tests if the substring of this string beginning at the
|
|
specified index starts with the specified prefix.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#subSequence(int, int)">subSequence</A></B>(int beginIndex,
|
|
int endIndex)</CODE>
|
|
|
|
<BR>
|
|
Returns a new character sequence that is a subsequence of this sequence.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">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" title="class in java.lang">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" title="class in java.lang">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.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">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" title="class in java.util">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" title="class in java.lang">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" title="class in java.lang">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.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">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" title="class in java.util">Locale</A> locale)</CODE>
|
|
|
|
<BR>
|
|
Converts all of the characters in this <code>String</code> to upper
|
|
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" title="class in java.lang">String</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../java/lang/String.html#trim()">trim</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Returns a copy of the string, with leading and trailing whitespace
|
|
omitted.</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" title="class in java.lang">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" title="class in java.lang">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" title="class in java.lang">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" title="class in java.lang">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" title="class in java.lang">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" title="class in java.lang">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" title="class in java.lang">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" title="class in java.lang">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" title="class in java.lang">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" title="class in java.lang">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" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
|
|
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></B></TH>
|
|
</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" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
|
|
<B>Field Detail</B></FONT></TH>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<A NAME="CASE_INSENSITIVE_ORDER"><!-- --></A><H3>
|
|
CASE_INSENSITIVE_ORDER</H3>
|
|
<PRE>
|
|
public static final <A HREF="../../java/util/Comparator.html" title="interface in java.util">Comparator</A><<A HREF="../../java/lang/String.html" title="class in java.lang">String</A>> <B>CASE_INSENSITIVE_ORDER</B></PRE>
|
|
<DL>
|
|
<DD>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.
|
|
<P>
|
|
<DL>
|
|
<DT><B>Since:</B></DT>
|
|
<DD>1.2</DD>
|
|
<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></DL>
|
|
</DL>
|
|
|
|
<!-- ========= CONSTRUCTOR DETAIL ======== -->
|
|
|
|
<A NAME="constructor_detail"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
|
|
<B>Constructor Detail</B></FONT></TH>
|
|
</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. Note that use of this constructor is
|
|
unnecessary since Strings are immutable.
|
|
<P>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="String(java.lang.String)"><!-- --></A><H3>
|
|
String</H3>
|
|
<PRE>
|
|
public <B>String</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> original)</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. Unless an
|
|
explicit copy of <code>original</code> is needed, use of this constructor is
|
|
unnecessary since Strings are immutable.
|
|
<P>
|
|
<DL>
|
|
<DT><B>Parameters:</B><DD><CODE>original</CODE> - A <code>String</code></DL>
|
|
</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.
|
|
<P>
|
|
<DL>
|
|
<DT><B>Parameters:</B><DD><CODE>value</CODE> - The initial value of the string</DL>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="String(char[], int, int)"><!-- --></A><H3>
|
|
String</H3>
|
|
<PRE>
|
|
public <B>String</B>(char[] value,
|
|
int offset,
|
|
int count)</PRE>
|
|
<DL>
|
|
<DD>Allocates a new <code>String</code> that contains characters from a subarray
|
|
of the character array argument. The <code>offset</code> argument is the
|
|
index of the first character of the subarray and the <code>count</code>
|
|
argument specifies the length of the subarray. The contents of the
|
|
subarray are copied; subsequent modification of the character array does
|
|
not affect the newly created string.
|
|
<P>
|
|
<DL>
|
|
<DT><B>Parameters:</B><DD><CODE>value</CODE> - Array that is the source of characters<DD><CODE>offset</CODE> - The initial offset<DD><CODE>count</CODE> - The length
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - If the <code>offset</code> and <code>count</code> arguments index
|
|
characters outside the bounds of the <code>value</code> array</DL>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="String(int[], int, int)"><!-- --></A><H3>
|
|
String</H3>
|
|
<PRE>
|
|
public <B>String</B>(int[] codePoints,
|
|
int offset,
|
|
int count)</PRE>
|
|
<DL>
|
|
<DD>Allocates a new <code>String</code> that contains characters from a subarray
|
|
of the Unicode code point array argument. The <code>offset</code> argument
|
|
is the index of the first code point of the subarray and the
|
|
<code>count</code> argument specifies the length of the subarray. The
|
|
contents of the subarray are converted to <code>char</code>s; subsequent
|
|
modification of the <code>int</code> array does not affect the newly created
|
|
string.
|
|
<P>
|
|
<DL>
|
|
<DT><B>Parameters:</B><DD><CODE>codePoints</CODE> - Array that is the source of Unicode code points<DD><CODE>offset</CODE> - The initial offset<DD><CODE>count</CODE> - The length
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A></CODE> - If any invalid Unicode code point is found in <code>codePoints</code>
|
|
<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - If the <code>offset</code> and <code>count</code> arguments index
|
|
characters outside the bounds of the <code>codePoints</code> array<DT><B>Since:</B></DT>
|
|
<DD>1.5</DD>
|
|
</DL>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="String(byte[], int, int, int)"><!-- --></A><H3>
|
|
String</H3>
|
|
<PRE>
|
|
<FONT SIZE="-1"><A HREF="../../java/lang/Deprecated.html" title="annotation in java.lang">@Deprecated</A>
|
|
</FONT>public <B>String</B>(byte[] ascii,
|
|
int hibyte,
|
|
int offset,
|
|
int count)</PRE>
|
|
<DL>
|
|
<DD><B>Deprecated.</B> <I>This method does not properly convert bytes into characters.
|
|
As of JDK 1.1, the preferred way to do this is via the
|
|
<code>String</code> constructors that take a <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset"><CODE>Charset</CODE></A>, charset name, or that use the platform's
|
|
default charset.</I>
|
|
<P>
|
|
<DD>Allocates a new <code>String</code> constructed from a subarray of an array
|
|
of 8-bit integer values.
|
|
|
|
<p> The <code>offset</code> argument is the index of the first byte of the
|
|
subarray, and the <code>count</code> argument specifies the length of the
|
|
subarray.
|
|
|
|
<p> Each <code>byte</code> in the subarray is converted to a <code>char</code> as
|
|
specified in the method above.
|
|
<P>
|
|
<DL>
|
|
<DT><B>Parameters:</B><DD><CODE>ascii</CODE> - The bytes to be converted to characters<DD><CODE>hibyte</CODE> - The top 8 bits of each 16-bit Unicode code unit<DD><CODE>offset</CODE> - The initial offset<DD><CODE>count</CODE> - The length
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - If the <code>offset</code> or <code>count</code> argument is invalid<DT><B>See Also:</B><DD><A HREF="../../java/lang/String.html#String(byte[], int)"><CODE>String(byte[], int)</CODE></A>,
|
|
<A HREF="../../java/lang/String.html#String(byte[], int, int, java.lang.String)"><CODE>String(byte[], int, int, java.lang.String)</CODE></A>,
|
|
<A HREF="../../java/lang/String.html#String(byte[], int, int, java.nio.charset.Charset)"><CODE>String(byte[], int, int, java.nio.charset.Charset)</CODE></A>,
|
|
<A HREF="../../java/lang/String.html#String(byte[], int, int)"><CODE>String(byte[], int, int)</CODE></A>,
|
|
<A HREF="../../java/lang/String.html#String(byte[], java.lang.String)"><CODE>String(byte[], java.lang.String)</CODE></A>,
|
|
<A HREF="../../java/lang/String.html#String(byte[], java.nio.charset.Charset)"><CODE>String(byte[], java.nio.charset.Charset)</CODE></A>,
|
|
<A HREF="../../java/lang/String.html#String(byte[])"><CODE>String(byte[])</CODE></A></DL>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="String(byte[], int)"><!-- --></A><H3>
|
|
String</H3>
|
|
<PRE>
|
|
<FONT SIZE="-1"><A HREF="../../java/lang/Deprecated.html" title="annotation in java.lang">@Deprecated</A>
|
|
</FONT>public <B>String</B>(byte[] ascii,
|
|
int hibyte)</PRE>
|
|
<DL>
|
|
<DD><B>Deprecated.</B> <I>This method does not properly convert bytes into
|
|
characters. As of JDK 1.1, the preferred way to do this is via the
|
|
<code>String</code> constructors that take a <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset"><CODE>Charset</CODE></A>, charset name, or that use the platform's
|
|
default charset.</I>
|
|
<P>
|
|
<DD>Allocates a new <code>String</code> containing characters constructed from
|
|
an array of 8-bit integer values. Each character <i>c</i>in the
|
|
resulting string is constructed from the corresponding component
|
|
<i>b</i> in the byte array such that:
|
|
|
|
<blockquote><pre>
|
|
<b><i>c</i></b> == (char)(((hibyte & 0xff) << 8)
|
|
| (<b><i>b</i></b> & 0xff))
|
|
</pre></blockquote>
|
|
<P>
|
|
<DL>
|
|
<DT><B>Parameters:</B><DD><CODE>ascii</CODE> - The bytes to be converted to characters<DD><CODE>hibyte</CODE> - The top 8 bits of each 16-bit Unicode code unit<DT><B>See Also:</B><DD><A HREF="../../java/lang/String.html#String(byte[], int, int, java.lang.String)"><CODE>String(byte[], int, int, java.lang.String)</CODE></A>,
|
|
<A HREF="../../java/lang/String.html#String(byte[], int, int, java.nio.charset.Charset)"><CODE>String(byte[], int, int, java.nio.charset.Charset)</CODE></A>,
|
|
<A HREF="../../java/lang/String.html#String(byte[], int, int)"><CODE>String(byte[], int, int)</CODE></A>,
|
|
<A HREF="../../java/lang/String.html#String(byte[], java.lang.String)"><CODE>String(byte[], java.lang.String)</CODE></A>,
|
|
<A HREF="../../java/lang/String.html#String(byte[], java.nio.charset.Charset)"><CODE>String(byte[], java.nio.charset.Charset)</CODE></A>,
|
|
<A HREF="../../java/lang/String.html#String(byte[])"><CODE>String(byte[])</CODE></A></DL>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="String(byte[], int, int, java.lang.String)"><!-- --></A><H3>
|
|
String</H3>
|
|
<PRE>
|
|
public <B>String</B>(byte[] bytes,
|
|
int offset,
|
|
int length,
|
|
<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> charsetName)
|
|
throws <A HREF="../../java/io/UnsupportedEncodingException.html" title="class in java.io">UnsupportedEncodingException</A></PRE>
|
|
<DL>
|
|
<DD>Constructs a new <code>String</code> by decoding the specified subarray of
|
|
bytes using the specified charset. The length of the new <code>String</code>
|
|
is a function of the charset, and hence may not be equal to the length
|
|
of the subarray.
|
|
|
|
<p> The behavior of this constructor when the given bytes are not valid
|
|
in the given charset is unspecified. The <A HREF="../../java/nio/charset/CharsetDecoder.html" title="class in java.nio.charset"><CODE>CharsetDecoder</CODE></A> class should be used when more control
|
|
over the decoding process is required.
|
|
<P>
|
|
<DL>
|
|
<DT><B>Parameters:</B><DD><CODE>bytes</CODE> - The bytes to be decoded into characters<DD><CODE>offset</CODE> - The index of the first byte to decode<DD><CODE>length</CODE> - The number of bytes to decode<DD><CODE>charsetName</CODE> - The name of a supported <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/io/UnsupportedEncodingException.html" title="class in java.io">UnsupportedEncodingException</A></CODE> - If the named charset is not supported
|
|
<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - If the <code>offset</code> and <code>length</code> arguments index
|
|
characters outside the bounds of the <code>bytes</code> array<DT><B>Since:</B></DT>
|
|
<DD>JDK1.1</DD>
|
|
</DL>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="String(byte[], int, int, java.nio.charset.Charset)"><!-- --></A><H3>
|
|
String</H3>
|
|
<PRE>
|
|
public <B>String</B>(byte[] bytes,
|
|
int offset,
|
|
int length,
|
|
<A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">Charset</A> charset)</PRE>
|
|
<DL>
|
|
<DD>Constructs a new <code>String</code> by decoding the specified subarray of
|
|
bytes using the specified <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>.
|
|
The length of the new <code>String</code> is a function of the charset, and
|
|
hence may not be equal to the length of the subarray.
|
|
|
|
<p> This method always replaces malformed-input and unmappable-character
|
|
sequences with this charset's default replacement string. The <A HREF="../../java/nio/charset/CharsetDecoder.html" title="class in java.nio.charset"><CODE>CharsetDecoder</CODE></A> class should be used when more control
|
|
over the decoding process is required.
|
|
<P>
|
|
<DL>
|
|
<DT><B>Parameters:</B><DD><CODE>bytes</CODE> - The bytes to be decoded into characters<DD><CODE>offset</CODE> - The index of the first byte to decode<DD><CODE>length</CODE> - The number of bytes to decode<DD><CODE>charset</CODE> - The <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A> to be used to
|
|
decode the <code>bytes</code>
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - If the <code>offset</code> and <code>length</code> arguments index
|
|
characters outside the bounds of the <code>bytes</code> array<DT><B>Since:</B></DT>
|
|
<DD>1.6</DD>
|
|
</DL>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="String(byte[], java.lang.String)"><!-- --></A><H3>
|
|
String</H3>
|
|
<PRE>
|
|
public <B>String</B>(byte[] bytes,
|
|
<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> charsetName)
|
|
throws <A HREF="../../java/io/UnsupportedEncodingException.html" title="class in java.io">UnsupportedEncodingException</A></PRE>
|
|
<DL>
|
|
<DD>Constructs a new <code>String</code> by decoding the specified array of bytes
|
|
using the specified <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>. The
|
|
length of the new <code>String</code> is a function of the charset, and hence
|
|
may not be equal to the length of the byte array.
|
|
|
|
<p> The behavior of this constructor when the given bytes are not valid
|
|
in the given charset is unspecified. The <A HREF="../../java/nio/charset/CharsetDecoder.html" title="class in java.nio.charset"><CODE>CharsetDecoder</CODE></A> class should be used when more control
|
|
over the decoding process is required.
|
|
<P>
|
|
<DL>
|
|
<DT><B>Parameters:</B><DD><CODE>bytes</CODE> - The bytes to be decoded into characters<DD><CODE>charsetName</CODE> - The name of a supported <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/io/UnsupportedEncodingException.html" title="class in java.io">UnsupportedEncodingException</A></CODE> - If the named charset is not supported<DT><B>Since:</B></DT>
|
|
<DD>JDK1.1</DD>
|
|
</DL>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="String(byte[], java.nio.charset.Charset)"><!-- --></A><H3>
|
|
String</H3>
|
|
<PRE>
|
|
public <B>String</B>(byte[] bytes,
|
|
<A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">Charset</A> charset)</PRE>
|
|
<DL>
|
|
<DD>Constructs a new <code>String</code> by decoding the specified array of
|
|
bytes using the specified <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>.
|
|
The length of the new <code>String</code> is a function of the charset, and
|
|
hence may not be equal to the length of the byte array.
|
|
|
|
<p> This method always replaces malformed-input and unmappable-character
|
|
sequences with this charset's default replacement string. The <A HREF="../../java/nio/charset/CharsetDecoder.html" title="class in java.nio.charset"><CODE>CharsetDecoder</CODE></A> class should be used when more control
|
|
over the decoding process is required.
|
|
<P>
|
|
<DL>
|
|
<DT><B>Parameters:</B><DD><CODE>bytes</CODE> - The bytes to be decoded into characters<DD><CODE>charset</CODE> - The <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A> to be used to
|
|
decode the <code>bytes</code><DT><B>Since:</B></DT>
|
|
<DD>1.6</DD>
|
|
</DL>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="String(byte[], int, int)"><!-- --></A><H3>
|
|
String</H3>
|
|
<PRE>
|
|
public <B>String</B>(byte[] bytes,
|
|
int offset,
|
|
int length)</PRE>
|
|
<DL>
|
|
<DD>Constructs a new <code>String</code> by decoding the specified subarray of
|
|
bytes using the platform's default charset. The length of the new
|
|
<code>String</code> is a function of the charset, and hence may not be equal
|
|
to the length of the subarray.
|
|
|
|
<p> The behavior of this constructor when the given bytes are not valid
|
|
in the default charset is unspecified. The <A HREF="../../java/nio/charset/CharsetDecoder.html" title="class in java.nio.charset"><CODE>CharsetDecoder</CODE></A> class should be used when more control
|
|
over the decoding process is required.
|
|
<P>
|
|
<DL>
|
|
<DT><B>Parameters:</B><DD><CODE>bytes</CODE> - The bytes to be decoded into characters<DD><CODE>offset</CODE> - The index of the first byte to decode<DD><CODE>length</CODE> - The number of bytes to decode
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - If the <code>offset</code> and the <code>length</code> arguments index
|
|
characters outside the bounds of the <code>bytes</code> array<DT><B>Since:</B></DT>
|
|
<DD>JDK1.1</DD>
|
|
</DL>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="String(byte[])"><!-- --></A><H3>
|
|
String</H3>
|
|
<PRE>
|
|
public <B>String</B>(byte[] bytes)</PRE>
|
|
<DL>
|
|
<DD>Constructs a new <code>String</code> by decoding the specified array of bytes
|
|
using the platform's default charset. The length of the new <code>String</code> is a function of the charset, and hence may not be equal to the
|
|
length of the byte array.
|
|
|
|
<p> The behavior of this constructor when the given bytes are not valid
|
|
in the default charset is unspecified. The <A HREF="../../java/nio/charset/CharsetDecoder.html" title="class in java.nio.charset"><CODE>CharsetDecoder</CODE></A> class should be used when more control
|
|
over the decoding process is required.
|
|
<P>
|
|
<DL>
|
|
<DT><B>Parameters:</B><DD><CODE>bytes</CODE> - The bytes to be decoded into characters<DT><B>Since:</B></DT>
|
|
<DD>JDK1.1</DD>
|
|
</DL>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="String(java.lang.StringBuffer)"><!-- --></A><H3>
|
|
String</H3>
|
|
<PRE>
|
|
public <B>String</B>(<A HREF="../../java/lang/StringBuffer.html" title="class in java.lang">StringBuffer</A> buffer)</PRE>
|
|
<DL>
|
|
<DD>Allocates a new string that contains the sequence of characters
|
|
currently contained in the string buffer argument. The contents of the
|
|
string buffer are copied; subsequent modification of the string buffer
|
|
does not affect the newly created string.
|
|
<P>
|
|
<DL>
|
|
<DT><B>Parameters:</B><DD><CODE>buffer</CODE> - A <code>StringBuffer</code></DL>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="String(java.lang.StringBuilder)"><!-- --></A><H3>
|
|
String</H3>
|
|
<PRE>
|
|
public <B>String</B>(<A HREF="../../java/lang/StringBuilder.html" title="class in java.lang">StringBuilder</A> builder)</PRE>
|
|
<DL>
|
|
<DD>Allocates a new string that contains the sequence of characters
|
|
currently contained in the string builder argument. The contents of the
|
|
string builder are copied; subsequent modification of the string builder
|
|
does not affect the newly created string.
|
|
|
|
<p> This constructor is provided to ease migration to <code>StringBuilder</code>. Obtaining a string from a string builder via the <code>toString</code> method is likely to run faster and is generally preferred.
|
|
<P>
|
|
<DL>
|
|
<DT><B>Parameters:</B><DD><CODE>builder</CODE> - A <code>StringBuilder</code><DT><B>Since:</B></DT>
|
|
<DD>1.5</DD>
|
|
</DL>
|
|
</DL>
|
|
|
|
<!-- ============ METHOD DETAIL ========== -->
|
|
|
|
<A NAME="method_detail"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
|
|
<B>Method Detail</B></FONT></TH>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<A NAME="length()"><!-- --></A><H3>
|
|
length</H3>
|
|
<PRE>
|
|
public int <B>length</B>()</PRE>
|
|
<DL>
|
|
<DD>Returns the length of this string.
|
|
The length is equal to the number of <a href="Character.html#unicode">Unicode
|
|
code units</a> in the string.
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Specified by:</B><DD><CODE><A HREF="../../java/lang/CharSequence.html#length()">length</A></CODE> in interface <CODE><A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A></CODE></DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>the length of the sequence of characters represented by this
|
|
object.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="isEmpty()"><!-- --></A><H3>
|
|
isEmpty</H3>
|
|
<PRE>
|
|
public boolean <B>isEmpty</B>()</PRE>
|
|
<DL>
|
|
<DD>Returns <tt>true</tt> if, and only if, <A HREF="../../java/lang/String.html#length()"><CODE>length()</CODE></A> is <tt>0</tt>.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD><tt>true</tt> if <A HREF="../../java/lang/String.html#length()"><CODE>length()</CODE></A> is <tt>0</tt>, otherwise
|
|
<tt>false</tt><DT><B>Since:</B></DT>
|
|
<DD>1.6</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="charAt(int)"><!-- --></A><H3>
|
|
charAt</H3>
|
|
<PRE>
|
|
public char <B>charAt</B>(int index)</PRE>
|
|
<DL>
|
|
<DD>Returns the <code>char</code> value at the
|
|
specified index. An index ranges from <code>0</code> to
|
|
<code>length() - 1</code>. The first <code>char</code> value of the sequence
|
|
is at index <code>0</code>, the next at index <code>1</code>,
|
|
and so on, as for array indexing.
|
|
|
|
<p>If the <code>char</code> value specified by the index is a
|
|
<a href="Character.html#unicode">surrogate</a>, the surrogate
|
|
value is returned.
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Specified by:</B><DD><CODE><A HREF="../../java/lang/CharSequence.html#charAt(int)">charAt</A></CODE> in interface <CODE><A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A></CODE></DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>index</CODE> - the index of the <code>char</code> value.
|
|
<DT><B>Returns:</B><DD>the <code>char</code> value at the specified index of this string.
|
|
The first <code>char</code> value is at index <code>0</code>.
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if the <code>index</code>
|
|
argument is negative or not less than the length of this
|
|
string.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="codePointAt(int)"><!-- --></A><H3>
|
|
codePointAt</H3>
|
|
<PRE>
|
|
public int <B>codePointAt</B>(int index)</PRE>
|
|
<DL>
|
|
<DD>Returns the character (Unicode code point) at the specified
|
|
index. The index refers to <code>char</code> values
|
|
(Unicode code units) and ranges from <code>0</code> to
|
|
<A HREF="../../java/lang/String.html#length()"><CODE>length()</CODE></A><code> - 1</code>.
|
|
|
|
<p> If the <code>char</code> value specified at the given index
|
|
is in the high-surrogate range, the following index is less
|
|
than the length of this <code>String</code>, and the
|
|
<code>char</code> value at the following index is in the
|
|
low-surrogate range, then the supplementary code point
|
|
corresponding to this surrogate pair is returned. Otherwise,
|
|
the <code>char</code> value at the given index is returned.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>index</CODE> - the index to the <code>char</code> values
|
|
<DT><B>Returns:</B><DD>the code point value of the character at the
|
|
<code>index</code>
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if the <code>index</code>
|
|
argument is negative or not less than the length of this
|
|
string.<DT><B>Since:</B></DT>
|
|
<DD>1.5</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="codePointBefore(int)"><!-- --></A><H3>
|
|
codePointBefore</H3>
|
|
<PRE>
|
|
public int <B>codePointBefore</B>(int index)</PRE>
|
|
<DL>
|
|
<DD>Returns the character (Unicode code point) before the specified
|
|
index. The index refers to <code>char</code> values
|
|
(Unicode code units) and ranges from <code>1</code> to <A HREF="../../java/lang/CharSequence.html#length()"><CODE>length</CODE></A>.
|
|
|
|
<p> If the <code>char</code> value at <code>(index - 1)</code>
|
|
is in the low-surrogate range, <code>(index - 2)</code> is not
|
|
negative, and the <code>char</code> value at <code>(index -
|
|
2)</code> is in the high-surrogate range, then the
|
|
supplementary code point value of the surrogate pair is
|
|
returned. If the <code>char</code> value at <code>index -
|
|
1</code> is an unpaired low-surrogate or a high-surrogate, the
|
|
surrogate value is returned.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>index</CODE> - the index following the code point that should be returned
|
|
<DT><B>Returns:</B><DD>the Unicode code point value before the given index.
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if the <code>index</code>
|
|
argument is less than 1 or greater than the length
|
|
of this string.<DT><B>Since:</B></DT>
|
|
<DD>1.5</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="codePointCount(int, int)"><!-- --></A><H3>
|
|
codePointCount</H3>
|
|
<PRE>
|
|
public int <B>codePointCount</B>(int beginIndex,
|
|
int endIndex)</PRE>
|
|
<DL>
|
|
<DD>Returns the number of Unicode code points in the specified text
|
|
range of this <code>String</code>. The text range begins at the
|
|
specified <code>beginIndex</code> and extends to the
|
|
<code>char</code> at index <code>endIndex - 1</code>. Thus the
|
|
length (in <code>char</code>s) of the text range is
|
|
<code>endIndex-beginIndex</code>. Unpaired surrogates within
|
|
the text range count as one code point each.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>beginIndex</CODE> - the index to the first <code>char</code> of
|
|
the text range.<DD><CODE>endIndex</CODE> - the index after the last <code>char</code> of
|
|
the text range.
|
|
<DT><B>Returns:</B><DD>the number of Unicode code points in the specified text
|
|
range
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if the
|
|
<code>beginIndex</code> is negative, or <code>endIndex</code>
|
|
is larger than the length of this <code>String</code>, or
|
|
<code>beginIndex</code> is larger than <code>endIndex</code>.<DT><B>Since:</B></DT>
|
|
<DD>1.5</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="offsetByCodePoints(int, int)"><!-- --></A><H3>
|
|
offsetByCodePoints</H3>
|
|
<PRE>
|
|
public int <B>offsetByCodePoints</B>(int index,
|
|
int codePointOffset)</PRE>
|
|
<DL>
|
|
<DD>Returns the index within this <code>String</code> that is
|
|
offset from the given <code>index</code> by
|
|
<code>codePointOffset</code> code points. Unpaired surrogates
|
|
within the text range given by <code>index</code> and
|
|
<code>codePointOffset</code> count as one code point each.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>index</CODE> - the index to be offset<DD><CODE>codePointOffset</CODE> - the offset in code points
|
|
<DT><B>Returns:</B><DD>the index within this <code>String</code>
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if <code>index</code>
|
|
is negative or larger then the length of this
|
|
<code>String</code>, or if <code>codePointOffset</code> is positive
|
|
and the substring starting with <code>index</code> has fewer
|
|
than <code>codePointOffset</code> code points,
|
|
or if <code>codePointOffset</code> is negative and the substring
|
|
before <code>index</code> has fewer than the absolute value
|
|
of <code>codePointOffset</code> code points.<DT><B>Since:</B></DT>
|
|
<DD>1.5</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="getChars(int, int, char[], int)"><!-- --></A><H3>
|
|
getChars</H3>
|
|
<PRE>
|
|
public void <B>getChars</B>(int srcBegin,
|
|
int srcEnd,
|
|
char[] dst,
|
|
int dstBegin)</PRE>
|
|
<DL>
|
|
<DD>Copies characters from this string into the destination character
|
|
array.
|
|
<p>
|
|
The first character to be copied is at index <code>srcBegin</code>;
|
|
the last character to be copied is at index <code>srcEnd-1</code>
|
|
(thus the total number of characters to be copied is
|
|
<code>srcEnd-srcBegin</code>). The characters are copied into the
|
|
subarray of <code>dst</code> starting at index <code>dstBegin</code>
|
|
and ending at index:
|
|
<p><blockquote><pre>
|
|
dstbegin + (srcEnd-srcBegin) - 1
|
|
</pre></blockquote>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>srcBegin</CODE> - index of the first character in the string
|
|
to copy.<DD><CODE>srcEnd</CODE> - index after the last character in the string
|
|
to copy.<DD><CODE>dst</CODE> - the destination array.<DD><CODE>dstBegin</CODE> - the start offset in the destination array.
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - If any of the following
|
|
is true:
|
|
<ul><li><code>srcBegin</code> is negative.
|
|
<li><code>srcBegin</code> is greater than <code>srcEnd</code>
|
|
<li><code>srcEnd</code> is greater than the length of this
|
|
string
|
|
<li><code>dstBegin</code> is negative
|
|
<li><code>dstBegin+(srcEnd-srcBegin)</code> is larger than
|
|
<code>dst.length</code></ul></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="getBytes(int, int, byte[], int)"><!-- --></A><H3>
|
|
getBytes</H3>
|
|
<PRE>
|
|
<FONT SIZE="-1"><A HREF="../../java/lang/Deprecated.html" title="annotation in java.lang">@Deprecated</A>
|
|
</FONT>public void <B>getBytes</B>(int srcBegin,
|
|
int srcEnd,
|
|
byte[] dst,
|
|
int dstBegin)</PRE>
|
|
<DL>
|
|
<DD><B>Deprecated.</B> <I>This method does not properly convert characters into
|
|
bytes. As of JDK 1.1, the preferred way to do this is via the
|
|
<A HREF="../../java/lang/String.html#getBytes()"><CODE>getBytes()</CODE></A> method, which uses the platform's default charset.</I>
|
|
<P>
|
|
<DD>Copies characters from this string into the destination byte array. Each
|
|
byte receives the 8 low-order bits of the corresponding character. The
|
|
eight high-order bits of each character are not copied and do not
|
|
participate in the transfer in any way.
|
|
|
|
<p> The first character to be copied is at index <code>srcBegin</code>; the
|
|
last character to be copied is at index <code>srcEnd-1</code>. The total
|
|
number of characters to be copied is <code>srcEnd-srcBegin</code>. The
|
|
characters, converted to bytes, are copied into the subarray of <code>dst</code> starting at index <code>dstBegin</code> and ending at index:
|
|
|
|
<blockquote><pre>
|
|
dstbegin + (srcEnd-srcBegin) - 1
|
|
</pre></blockquote>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>srcBegin</CODE> - Index of the first character in the string to copy<DD><CODE>srcEnd</CODE> - Index after the last character in the string to copy<DD><CODE>dst</CODE> - The destination array<DD><CODE>dstBegin</CODE> - The start offset in the destination array
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - If any of the following is true:
|
|
<ul>
|
|
<li> <code>srcBegin</code> is negative
|
|
<li> <code>srcBegin</code> is greater than <code>srcEnd</code>
|
|
<li> <code>srcEnd</code> is greater than the length of this String
|
|
<li> <code>dstBegin</code> is negative
|
|
<li> <code>dstBegin+(srcEnd-srcBegin)</code> is larger than <code>dst.length</code>
|
|
</ul></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="getBytes(java.lang.String)"><!-- --></A><H3>
|
|
getBytes</H3>
|
|
<PRE>
|
|
public byte[] <B>getBytes</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> charsetName)
|
|
throws <A HREF="../../java/io/UnsupportedEncodingException.html" title="class in java.io">UnsupportedEncodingException</A></PRE>
|
|
<DL>
|
|
<DD>Encodes this <code>String</code> into a sequence of bytes using the named
|
|
charset, storing the result into a new byte array.
|
|
|
|
<p> The behavior of this method when this string cannot be encoded in
|
|
the given charset is unspecified. The <A HREF="../../java/nio/charset/CharsetEncoder.html" title="class in java.nio.charset"><CODE>CharsetEncoder</CODE></A> class should be used when more control
|
|
over the encoding process is required.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>charsetName</CODE> - The name of a supported <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>
|
|
<DT><B>Returns:</B><DD>The resultant byte array
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/io/UnsupportedEncodingException.html" title="class in java.io">UnsupportedEncodingException</A></CODE> - If the named charset is not supported<DT><B>Since:</B></DT>
|
|
<DD>JDK1.1</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="getBytes(java.nio.charset.Charset)"><!-- --></A><H3>
|
|
getBytes</H3>
|
|
<PRE>
|
|
public byte[] <B>getBytes</B>(<A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">Charset</A> charset)</PRE>
|
|
<DL>
|
|
<DD>Encodes this <code>String</code> into a sequence of bytes using the given
|
|
<A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>, storing the result into a
|
|
new byte array.
|
|
|
|
<p> This method always replaces malformed-input and unmappable-character
|
|
sequences with this charset's default replacement byte array. The
|
|
<A HREF="../../java/nio/charset/CharsetEncoder.html" title="class in java.nio.charset"><CODE>CharsetEncoder</CODE></A> class should be used when more
|
|
control over the encoding process is required.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>charset</CODE> - The <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">Charset</A> to be used to encode
|
|
the <code>String</code>
|
|
<DT><B>Returns:</B><DD>The resultant byte array<DT><B>Since:</B></DT>
|
|
<DD>1.6</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="getBytes()"><!-- --></A><H3>
|
|
getBytes</H3>
|
|
<PRE>
|
|
public byte[] <B>getBytes</B>()</PRE>
|
|
<DL>
|
|
<DD>Encodes this <code>String</code> into a sequence of bytes using the
|
|
platform's default charset, storing the result into a new byte array.
|
|
|
|
<p> The behavior of this method when this string cannot be encoded in
|
|
the default charset is unspecified. The <A HREF="../../java/nio/charset/CharsetEncoder.html" title="class in java.nio.charset"><CODE>CharsetEncoder</CODE></A> class should be used when more control
|
|
over the encoding process is required.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>The resultant byte array<DT><B>Since:</B></DT>
|
|
<DD>JDK1.1</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="equals(java.lang.Object)"><!-- --></A><H3>
|
|
equals</H3>
|
|
<PRE>
|
|
public boolean <B>equals</B>(<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A> anObject)</PRE>
|
|
<DL>
|
|
<DD>Compares this string to the specified object. The result is <code>true</code> if and only if the argument is not <code>null</code> and is a <code>String</code> object that represents the same sequence of characters as this
|
|
object.
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></CODE></DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>anObject</CODE> - The object to compare this <code>String</code> against
|
|
<DT><B>Returns:</B><DD><code>true</code> if the given object represents a <code>String</code>
|
|
equivalent to this string, <code>false</code> otherwise<DT><B>See Also:</B><DD><A HREF="../../java/lang/String.html#compareTo(java.lang.String)"><CODE>compareTo(String)</CODE></A>,
|
|
<A HREF="../../java/lang/String.html#equalsIgnoreCase(java.lang.String)"><CODE>equalsIgnoreCase(String)</CODE></A></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="contentEquals(java.lang.StringBuffer)"><!-- --></A><H3>
|
|
contentEquals</H3>
|
|
<PRE>
|
|
public boolean <B>contentEquals</B>(<A HREF="../../java/lang/StringBuffer.html" title="class in java.lang">StringBuffer</A> sb)</PRE>
|
|
<DL>
|
|
<DD>Compares this string to the specified <code>StringBuffer</code>. The result
|
|
is <code>true</code> if and only if this <code>String</code> represents the same
|
|
sequence of characters as the specified <code>StringBuffer</code>.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>sb</CODE> - The <code>StringBuffer</code> to compare this <code>String</code> against
|
|
<DT><B>Returns:</B><DD><code>true</code> if this <code>String</code> represents the same
|
|
sequence of characters as the specified <code>StringBuffer</code>,
|
|
<code>false</code> otherwise<DT><B>Since:</B></DT>
|
|
<DD>1.4</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="contentEquals(java.lang.CharSequence)"><!-- --></A><H3>
|
|
contentEquals</H3>
|
|
<PRE>
|
|
public boolean <B>contentEquals</B>(<A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A> cs)</PRE>
|
|
<DL>
|
|
<DD>Compares this string to the specified <code>CharSequence</code>. The result
|
|
is <code>true</code> if and only if this <code>String</code> represents the same
|
|
sequence of char values as the specified sequence.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>cs</CODE> - The sequence to compare this <code>String</code> against
|
|
<DT><B>Returns:</B><DD><code>true</code> if this <code>String</code> represents the same
|
|
sequence of char values as the specified sequence, <code>false</code> otherwise<DT><B>Since:</B></DT>
|
|
<DD>1.5</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="equalsIgnoreCase(java.lang.String)"><!-- --></A><H3>
|
|
equalsIgnoreCase</H3>
|
|
<PRE>
|
|
public boolean <B>equalsIgnoreCase</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> anotherString)</PRE>
|
|
<DL>
|
|
<DD>Compares this <code>String</code> to another <code>String</code>, ignoring case
|
|
considerations. Two strings are considered equal ignoring case if they
|
|
are of the same length and corresponding characters in the two strings
|
|
are equal ignoring case.
|
|
|
|
<p> Two characters <code>c1</code> and <code>c2</code> are considered the same
|
|
ignoring case if at least one of the following is true:
|
|
<ul>
|
|
<li> The two characters are the same (as compared by the
|
|
<code>==</code> operator)
|
|
<li> Applying the method <A HREF="../../java/lang/Character.html#toUpperCase(char)"><CODE>Character.toUpperCase(char)</CODE></A> to each character
|
|
produces the same result
|
|
<li> Applying the method <A HREF="../../java/lang/Character.html#toLowerCase(char)"><CODE>Character.toLowerCase(char)</CODE></A> to each character
|
|
produces the same result
|
|
</ul>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>anotherString</CODE> - The <code>String</code> to compare this <code>String</code> against
|
|
<DT><B>Returns:</B><DD><code>true</code> if the argument is not <code>null</code> and it
|
|
represents an equivalent <code>String</code> ignoring case; <code>false</code> otherwise<DT><B>See Also:</B><DD><A HREF="../../java/lang/String.html#equals(java.lang.Object)"><CODE>equals(Object)</CODE></A></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="compareTo(java.lang.String)"><!-- --></A><H3>
|
|
compareTo</H3>
|
|
<PRE>
|
|
public int <B>compareTo</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> anotherString)</PRE>
|
|
<DL>
|
|
<DD>Compares two strings lexicographically.
|
|
The comparison is based on the Unicode value of each character in
|
|
the strings. The character sequence represented by this
|
|
<code>String</code> object is compared lexicographically to the
|
|
character sequence represented by the argument string. The result is
|
|
a negative integer if this <code>String</code> object
|
|
lexicographically precedes the argument string. The result is a
|
|
positive integer if this <code>String</code> object lexicographically
|
|
follows the argument string. The result is zero if the strings
|
|
are equal; <code>compareTo</code> returns <code>0</code> exactly when
|
|
the <A HREF="../../java/lang/String.html#equals(java.lang.Object)"><CODE>equals(Object)</CODE></A> method would return <code>true</code>.
|
|
<p>
|
|
This is the definition of lexicographic ordering. If two strings are
|
|
different, then either they have different characters at some index
|
|
that is a valid index for both strings, or their lengths are different,
|
|
or both. If they have different characters at one or more index
|
|
positions, let <i>k</i> be the smallest such index; then the string
|
|
whose character at position <i>k</i> has the smaller value, as
|
|
determined by using the < operator, lexicographically precedes the
|
|
other string. In this case, <code>compareTo</code> returns the
|
|
difference of the two character values at position <code>k</code> in
|
|
the two string -- that is, the value:
|
|
<blockquote><pre>
|
|
this.charAt(k)-anotherString.charAt(k)
|
|
</pre></blockquote>
|
|
If there is no index position at which they differ, then the shorter
|
|
string lexicographically precedes the longer string. In this case,
|
|
<code>compareTo</code> returns the difference of the lengths of the
|
|
strings -- that is, the value:
|
|
<blockquote><pre>
|
|
this.length()-anotherString.length()
|
|
</pre></blockquote>
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Specified by:</B><DD><CODE><A HREF="../../java/lang/Comparable.html#compareTo(T)">compareTo</A></CODE> in interface <CODE><A HREF="../../java/lang/Comparable.html" title="interface in java.lang">Comparable</A><<A HREF="../../java/lang/String.html" title="class in java.lang">String</A>></CODE></DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>anotherString</CODE> - the <code>String</code> to be compared.
|
|
<DT><B>Returns:</B><DD>the value <code>0</code> if the argument string is equal to
|
|
this string; a value less than <code>0</code> if this string
|
|
is lexicographically less than the string argument; and a
|
|
value greater than <code>0</code> if this string is
|
|
lexicographically greater than the string argument.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="compareToIgnoreCase(java.lang.String)"><!-- --></A><H3>
|
|
compareToIgnoreCase</H3>
|
|
<PRE>
|
|
public int <B>compareToIgnoreCase</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str)</PRE>
|
|
<DL>
|
|
<DD>Compares two strings lexicographically, ignoring case
|
|
differences. This method returns an integer whose sign is that of
|
|
calling <code>compareTo</code> with normalized versions of the strings
|
|
where case differences have been eliminated by calling
|
|
<code>Character.toLowerCase(Character.toUpperCase(character))</code> on
|
|
each character.
|
|
<p>
|
|
Note that this method 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.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>str</CODE> - the <code>String</code> to be compared.
|
|
<DT><B>Returns:</B><DD>a negative integer, zero, or a positive integer as the
|
|
specified String is greater than, equal to, or less
|
|
than this String, ignoring case considerations.<DT><B>Since:</B></DT>
|
|
<DD>1.2</DD>
|
|
<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></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="regionMatches(int, java.lang.String, int, int)"><!-- --></A><H3>
|
|
regionMatches</H3>
|
|
<PRE>
|
|
public boolean <B>regionMatches</B>(int toffset,
|
|
<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> other,
|
|
int ooffset,
|
|
int len)</PRE>
|
|
<DL>
|
|
<DD>Tests if two string regions are equal.
|
|
<p>
|
|
A substring of this <tt>String</tt> object is compared to a substring
|
|
of the argument other. The result is true if these substrings
|
|
represent identical character sequences. The substring of this
|
|
<tt>String</tt> object to be compared begins at index <tt>toffset</tt>
|
|
and has length <tt>len</tt>. The substring of other to be compared
|
|
begins at index <tt>ooffset</tt> and has length <tt>len</tt>. The
|
|
result is <tt>false</tt> if and only if at least one of the following
|
|
is true:
|
|
<ul><li><tt>toffset</tt> is negative.
|
|
<li><tt>ooffset</tt> is negative.
|
|
<li><tt>toffset+len</tt> is greater than the length of this
|
|
<tt>String</tt> object.
|
|
<li><tt>ooffset+len</tt> is greater than the length of the other
|
|
argument.
|
|
<li>There is some nonnegative integer <i>k</i> less than <tt>len</tt>
|
|
such that:
|
|
<tt>this.charAt(toffset+<i>k</i>) != other.charAt(ooffset+<i>k</i>)</tt>
|
|
</ul>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>toffset</CODE> - the starting offset of the subregion in this string.<DD><CODE>other</CODE> - the string argument.<DD><CODE>ooffset</CODE> - the starting offset of the subregion in the string
|
|
argument.<DD><CODE>len</CODE> - the number of characters to compare.
|
|
<DT><B>Returns:</B><DD><code>true</code> if the specified subregion of this string
|
|
exactly matches the specified subregion of the string argument;
|
|
<code>false</code> otherwise.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="regionMatches(boolean, int, java.lang.String, int, int)"><!-- --></A><H3>
|
|
regionMatches</H3>
|
|
<PRE>
|
|
public boolean <B>regionMatches</B>(boolean ignoreCase,
|
|
int toffset,
|
|
<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> other,
|
|
int ooffset,
|
|
int len)</PRE>
|
|
<DL>
|
|
<DD>Tests if two string regions are equal.
|
|
<p>
|
|
A substring of this <tt>String</tt> object is compared to a substring
|
|
of the argument <tt>other</tt>. The result is <tt>true</tt> if these
|
|
substrings represent character sequences that are the same, ignoring
|
|
case if and only if <tt>ignoreCase</tt> is true. The substring of
|
|
this <tt>String</tt> object to be compared begins at index
|
|
<tt>toffset</tt> and has length <tt>len</tt>. The substring of
|
|
<tt>other</tt> to be compared begins at index <tt>ooffset</tt> and
|
|
has length <tt>len</tt>. The result is <tt>false</tt> if and only if
|
|
at least one of the following is true:
|
|
<ul><li><tt>toffset</tt> is negative.
|
|
<li><tt>ooffset</tt> is negative.
|
|
<li><tt>toffset+len</tt> is greater than the length of this
|
|
<tt>String</tt> object.
|
|
<li><tt>ooffset+len</tt> is greater than the length of the other
|
|
argument.
|
|
<li><tt>ignoreCase</tt> is <tt>false</tt> and there is some nonnegative
|
|
integer <i>k</i> less than <tt>len</tt> such that:
|
|
<blockquote><pre>
|
|
this.charAt(toffset+k) != other.charAt(ooffset+k)
|
|
</pre></blockquote>
|
|
<li><tt>ignoreCase</tt> is <tt>true</tt> and there is some nonnegative
|
|
integer <i>k</i> less than <tt>len</tt> such that:
|
|
<blockquote><pre>
|
|
Character.toLowerCase(this.charAt(toffset+k)) !=
|
|
Character.toLowerCase(other.charAt(ooffset+k))
|
|
</pre></blockquote>
|
|
and:
|
|
<blockquote><pre>
|
|
Character.toUpperCase(this.charAt(toffset+k)) !=
|
|
Character.toUpperCase(other.charAt(ooffset+k))
|
|
</pre></blockquote>
|
|
</ul>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>ignoreCase</CODE> - if <code>true</code>, ignore case when comparing
|
|
characters.<DD><CODE>toffset</CODE> - the starting offset of the subregion in this
|
|
string.<DD><CODE>other</CODE> - the string argument.<DD><CODE>ooffset</CODE> - the starting offset of the subregion in the string
|
|
argument.<DD><CODE>len</CODE> - the number of characters to compare.
|
|
<DT><B>Returns:</B><DD><code>true</code> if the specified subregion of this string
|
|
matches the specified subregion of the string argument;
|
|
<code>false</code> otherwise. Whether the matching is exact
|
|
or case insensitive depends on the <code>ignoreCase</code>
|
|
argument.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="startsWith(java.lang.String, int)"><!-- --></A><H3>
|
|
startsWith</H3>
|
|
<PRE>
|
|
public boolean <B>startsWith</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> prefix,
|
|
int toffset)</PRE>
|
|
<DL>
|
|
<DD>Tests if the substring of this string beginning at the
|
|
specified index starts with the specified prefix.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>prefix</CODE> - the prefix.<DD><CODE>toffset</CODE> - where to begin looking in this string.
|
|
<DT><B>Returns:</B><DD><code>true</code> if the character sequence represented by the
|
|
argument is a prefix of the substring of this object starting
|
|
at index <code>toffset</code>; <code>false</code> otherwise.
|
|
The result is <code>false</code> if <code>toffset</code> is
|
|
negative or greater than the length of this
|
|
<code>String</code> object; otherwise the result is the same
|
|
as the result of the expression
|
|
<pre>
|
|
this.substring(toffset).startsWith(prefix)
|
|
</pre></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="startsWith(java.lang.String)"><!-- --></A><H3>
|
|
startsWith</H3>
|
|
<PRE>
|
|
public boolean <B>startsWith</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> prefix)</PRE>
|
|
<DL>
|
|
<DD>Tests if this string starts with the specified prefix.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>prefix</CODE> - the prefix.
|
|
<DT><B>Returns:</B><DD><code>true</code> if the character sequence represented by the
|
|
argument is a prefix of the character sequence represented by
|
|
this string; <code>false</code> otherwise.
|
|
Note also that <code>true</code> will be returned if the
|
|
argument is an empty string or is equal to this
|
|
<code>String</code> object as determined by the
|
|
<A HREF="../../java/lang/String.html#equals(java.lang.Object)"><CODE>equals(Object)</CODE></A> method.<DT><B>Since:</B></DT>
|
|
<DD>1. 0</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="endsWith(java.lang.String)"><!-- --></A><H3>
|
|
endsWith</H3>
|
|
<PRE>
|
|
public boolean <B>endsWith</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> suffix)</PRE>
|
|
<DL>
|
|
<DD>Tests if this string ends with the specified suffix.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>suffix</CODE> - the suffix.
|
|
<DT><B>Returns:</B><DD><code>true</code> if the character sequence represented by the
|
|
argument is a suffix of the character sequence represented by
|
|
this object; <code>false</code> otherwise. Note that the
|
|
result will be <code>true</code> if the argument is the
|
|
empty string or is equal to this <code>String</code> object
|
|
as determined by the <A HREF="../../java/lang/String.html#equals(java.lang.Object)"><CODE>equals(Object)</CODE></A> method.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="hashCode()"><!-- --></A><H3>
|
|
hashCode</H3>
|
|
<PRE>
|
|
public int <B>hashCode</B>()</PRE>
|
|
<DL>
|
|
<DD>Returns a hash code for this string. The hash code for a
|
|
<code>String</code> object is computed as
|
|
<blockquote><pre>
|
|
s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
|
|
</pre></blockquote>
|
|
using <code>int</code> arithmetic, where <code>s[i]</code> is the
|
|
<i>i</i>th character of the string, <code>n</code> is the length of
|
|
the string, and <code>^</code> indicates exponentiation.
|
|
(The hash value of the empty string is zero.)
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#hashCode()">hashCode</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></CODE></DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>a hash code value for this object.<DT><B>See Also:</B><DD><A HREF="../../java/lang/Object.html#equals(java.lang.Object)"><CODE>Object.equals(java.lang.Object)</CODE></A>,
|
|
<A HREF="../../java/util/Hashtable.html" title="class in java.util"><CODE>Hashtable</CODE></A></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="indexOf(int)"><!-- --></A><H3>
|
|
indexOf</H3>
|
|
<PRE>
|
|
public int <B>indexOf</B>(int ch)</PRE>
|
|
<DL>
|
|
<DD>Returns the index within this string of the first occurrence of
|
|
the specified character. If a character with value
|
|
<code>ch</code> occurs in the character sequence represented by
|
|
this <code>String</code> object, then the index (in Unicode
|
|
code units) of the first such occurrence is returned. For
|
|
values of <code>ch</code> in the range from 0 to 0xFFFF
|
|
(inclusive), this is the smallest value <i>k</i> such that:
|
|
<blockquote><pre>
|
|
this.charAt(<i>k</i>) == ch
|
|
</pre></blockquote>
|
|
is true. For other values of <code>ch</code>, it is the
|
|
smallest value <i>k</i> such that:
|
|
<blockquote><pre>
|
|
this.codePointAt(<i>k</i>) == ch
|
|
</pre></blockquote>
|
|
is true. In either case, if no such character occurs in this
|
|
string, then <code>-1</code> is returned.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>ch</CODE> - a character (Unicode code point).
|
|
<DT><B>Returns:</B><DD>the index of the first occurrence of the character in the
|
|
character sequence represented by this object, or
|
|
<code>-1</code> if the character does not occur.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="indexOf(int, int)"><!-- --></A><H3>
|
|
indexOf</H3>
|
|
<PRE>
|
|
public int <B>indexOf</B>(int ch,
|
|
int fromIndex)</PRE>
|
|
<DL>
|
|
<DD>Returns the index within this string of the first occurrence of the
|
|
specified character, starting the search at the specified index.
|
|
<p>
|
|
If a character with value <code>ch</code> occurs in the
|
|
character sequence represented by this <code>String</code>
|
|
object at an index no smaller than <code>fromIndex</code>, then
|
|
the index of the first such occurrence is returned. For values
|
|
of <code>ch</code> in the range from 0 to 0xFFFF (inclusive),
|
|
this is the smallest value <i>k</i> such that:
|
|
<blockquote><pre>
|
|
(this.charAt(<i>k</i>) == ch) && (<i>k</i> >= fromIndex)
|
|
</pre></blockquote>
|
|
is true. For other values of <code>ch</code>, it is the
|
|
smallest value <i>k</i> such that:
|
|
<blockquote><pre>
|
|
(this.codePointAt(<i>k</i>) == ch) && (<i>k</i> >= fromIndex)
|
|
</pre></blockquote>
|
|
is true. In either case, if no such character occurs in this
|
|
string at or after position <code>fromIndex</code>, then
|
|
<code>-1</code> is returned.
|
|
|
|
<p>
|
|
There is no restriction on the value of <code>fromIndex</code>. If it
|
|
is negative, it has the same effect as if it were zero: this entire
|
|
string may be searched. If it is greater than the length of this
|
|
string, it has the same effect as if it were equal to the length of
|
|
this string: <code>-1</code> is returned.
|
|
|
|
<p>All indices are specified in <code>char</code> values
|
|
(Unicode code units).
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>ch</CODE> - a character (Unicode code point).<DD><CODE>fromIndex</CODE> - the index to start the search from.
|
|
<DT><B>Returns:</B><DD>the index of the first occurrence of the character in the
|
|
character sequence represented by this object that is greater
|
|
than or equal to <code>fromIndex</code>, or <code>-1</code>
|
|
if the character does not occur.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="lastIndexOf(int)"><!-- --></A><H3>
|
|
lastIndexOf</H3>
|
|
<PRE>
|
|
public int <B>lastIndexOf</B>(int ch)</PRE>
|
|
<DL>
|
|
<DD>Returns the index within this string of the last occurrence of
|
|
the specified character. For values of <code>ch</code> in the
|
|
range from 0 to 0xFFFF (inclusive), the index (in Unicode code
|
|
units) returned is the largest value <i>k</i> such that:
|
|
<blockquote><pre>
|
|
this.charAt(<i>k</i>) == ch
|
|
</pre></blockquote>
|
|
is true. For other values of <code>ch</code>, it is the
|
|
largest value <i>k</i> such that:
|
|
<blockquote><pre>
|
|
this.codePointAt(<i>k</i>) == ch
|
|
</pre></blockquote>
|
|
is true. In either case, if no such character occurs in this
|
|
string, then <code>-1</code> is returned. The
|
|
<code>String</code> is searched backwards starting at the last
|
|
character.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>ch</CODE> - a character (Unicode code point).
|
|
<DT><B>Returns:</B><DD>the index of the last occurrence of the character in the
|
|
character sequence represented by this object, or
|
|
<code>-1</code> if the character does not occur.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="lastIndexOf(int, int)"><!-- --></A><H3>
|
|
lastIndexOf</H3>
|
|
<PRE>
|
|
public int <B>lastIndexOf</B>(int ch,
|
|
int fromIndex)</PRE>
|
|
<DL>
|
|
<DD>Returns the index within this string of the last occurrence of
|
|
the specified character, searching backward starting at the
|
|
specified index. For values of <code>ch</code> in the range
|
|
from 0 to 0xFFFF (inclusive), the index returned is the largest
|
|
value <i>k</i> such that:
|
|
<blockquote><pre>
|
|
(this.charAt(<i>k</i>) == ch) && (<i>k</i> <= fromIndex)
|
|
</pre></blockquote>
|
|
is true. For other values of <code>ch</code>, it is the
|
|
largest value <i>k</i> such that:
|
|
<blockquote><pre>
|
|
(this.codePointAt(<i>k</i>) == ch) && (<i>k</i> <= fromIndex)
|
|
</pre></blockquote>
|
|
is true. In either case, if no such character occurs in this
|
|
string at or before position <code>fromIndex</code>, then
|
|
<code>-1</code> is returned.
|
|
|
|
<p>All indices are specified in <code>char</code> values
|
|
(Unicode code units).
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>ch</CODE> - a character (Unicode code point).<DD><CODE>fromIndex</CODE> - the index to start the search from. There is no
|
|
restriction on the value of <code>fromIndex</code>. If it is
|
|
greater than or equal to the length of this string, it has
|
|
the same effect as if it were equal to one less than the
|
|
length of this string: this entire string may be searched.
|
|
If it is negative, it has the same effect as if it were -1:
|
|
-1 is returned.
|
|
<DT><B>Returns:</B><DD>the index of the last occurrence of the character in the
|
|
character sequence represented by this object that is less
|
|
than or equal to <code>fromIndex</code>, or <code>-1</code>
|
|
if the character does not occur before that point.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="indexOf(java.lang.String)"><!-- --></A><H3>
|
|
indexOf</H3>
|
|
<PRE>
|
|
public int <B>indexOf</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str)</PRE>
|
|
<DL>
|
|
<DD>Returns the index within this string of the first occurrence of the
|
|
specified substring. The integer returned is the smallest value
|
|
<i>k</i> such that:
|
|
<blockquote><pre>
|
|
this.startsWith(str, <i>k</i>)
|
|
</pre></blockquote>
|
|
is <code>true</code>.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>str</CODE> - any string.
|
|
<DT><B>Returns:</B><DD>if the string argument occurs as a substring within this
|
|
object, then the index of the first character of the first
|
|
such substring is returned; if it does not occur as a
|
|
substring, <code>-1</code> is returned.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="indexOf(java.lang.String, int)"><!-- --></A><H3>
|
|
indexOf</H3>
|
|
<PRE>
|
|
public int <B>indexOf</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str,
|
|
int fromIndex)</PRE>
|
|
<DL>
|
|
<DD>Returns the index within this string of the first occurrence of the
|
|
specified substring, starting at the specified index. The integer
|
|
returned is the smallest value <tt>k</tt> for which:
|
|
<blockquote><pre>
|
|
k >= Math.min(fromIndex, this.length()) && this.startsWith(str, k)
|
|
</pre></blockquote>
|
|
If no such value of <i>k</i> exists, then -1 is returned.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>str</CODE> - the substring for which to search.<DD><CODE>fromIndex</CODE> - the index from which to start the search.
|
|
<DT><B>Returns:</B><DD>the index within this string of the first occurrence of the
|
|
specified substring, starting at the specified index.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="lastIndexOf(java.lang.String)"><!-- --></A><H3>
|
|
lastIndexOf</H3>
|
|
<PRE>
|
|
public int <B>lastIndexOf</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str)</PRE>
|
|
<DL>
|
|
<DD>Returns the index within this string of the rightmost occurrence
|
|
of the specified substring. The rightmost empty string "" is
|
|
considered to occur at the index value <code>this.length()</code>.
|
|
The returned index is the largest value <i>k</i> such that
|
|
<blockquote><pre>
|
|
this.startsWith(str, k)
|
|
</pre></blockquote>
|
|
is true.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>str</CODE> - the substring to search for.
|
|
<DT><B>Returns:</B><DD>if the string argument occurs one or more times as a substring
|
|
within this object, then the index of the first character of
|
|
the last such substring is returned. If it does not occur as
|
|
a substring, <code>-1</code> is returned.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="lastIndexOf(java.lang.String, int)"><!-- --></A><H3>
|
|
lastIndexOf</H3>
|
|
<PRE>
|
|
public int <B>lastIndexOf</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str,
|
|
int fromIndex)</PRE>
|
|
<DL>
|
|
<DD>Returns the index within this string of the last occurrence of the
|
|
specified substring, searching backward starting at the specified index.
|
|
The integer returned is the largest value <i>k</i> such that:
|
|
<blockquote><pre>
|
|
k <= Math.min(fromIndex, this.length()) && this.startsWith(str, k)
|
|
</pre></blockquote>
|
|
If no such value of <i>k</i> exists, then -1 is returned.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>str</CODE> - the substring to search for.<DD><CODE>fromIndex</CODE> - the index to start the search from.
|
|
<DT><B>Returns:</B><DD>the index within this string of the last occurrence of the
|
|
specified substring.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="substring(int)"><!-- --></A><H3>
|
|
substring</H3>
|
|
<PRE>
|
|
public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>substring</B>(int beginIndex)</PRE>
|
|
<DL>
|
|
<DD>Returns a new string that is a substring of this string. The
|
|
substring begins with the character at the specified index and
|
|
extends to the end of this string. <p>
|
|
Examples:
|
|
<blockquote><pre>
|
|
"unhappy".substring(2) returns "happy"
|
|
"Harbison".substring(3) returns "bison"
|
|
"emptiness".substring(9) returns "" (an empty string)
|
|
</pre></blockquote>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>beginIndex</CODE> - the beginning index, inclusive.
|
|
<DT><B>Returns:</B><DD>the specified substring.
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if
|
|
<code>beginIndex</code> is negative or larger than the
|
|
length of this <code>String</code> object.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="substring(int, int)"><!-- --></A><H3>
|
|
substring</H3>
|
|
<PRE>
|
|
public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>substring</B>(int beginIndex,
|
|
int endIndex)</PRE>
|
|
<DL>
|
|
<DD>Returns a new string that is a substring of this string. The
|
|
substring begins at the specified <code>beginIndex</code> and
|
|
extends to the character at index <code>endIndex - 1</code>.
|
|
Thus the length of the substring is <code>endIndex-beginIndex</code>.
|
|
<p>
|
|
Examples:
|
|
<blockquote><pre>
|
|
"hamburger".substring(4, 8) returns "urge"
|
|
"smiles".substring(1, 5) returns "mile"
|
|
</pre></blockquote>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>beginIndex</CODE> - the beginning index, inclusive.<DD><CODE>endIndex</CODE> - the ending index, exclusive.
|
|
<DT><B>Returns:</B><DD>the specified substring.
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if the
|
|
<code>beginIndex</code> is negative, or
|
|
<code>endIndex</code> is larger than the length of
|
|
this <code>String</code> object, or
|
|
<code>beginIndex</code> is larger than
|
|
<code>endIndex</code>.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="subSequence(int, int)"><!-- --></A><H3>
|
|
subSequence</H3>
|
|
<PRE>
|
|
public <A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A> <B>subSequence</B>(int beginIndex,
|
|
int endIndex)</PRE>
|
|
<DL>
|
|
<DD>Returns a new character sequence that is a subsequence of this sequence.
|
|
|
|
<p> An invocation of this method of the form
|
|
|
|
<blockquote><pre>
|
|
str.subSequence(begin, end)</pre></blockquote>
|
|
|
|
behaves in exactly the same way as the invocation
|
|
|
|
<blockquote><pre>
|
|
str.substring(begin, end)</pre></blockquote>
|
|
|
|
This method is defined so that the <tt>String</tt> class can implement
|
|
the <A HREF="../../java/lang/CharSequence.html" title="interface in java.lang"><CODE>CharSequence</CODE></A> interface. </p>
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Specified by:</B><DD><CODE><A HREF="../../java/lang/CharSequence.html#subSequence(int, int)">subSequence</A></CODE> in interface <CODE><A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A></CODE></DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>beginIndex</CODE> - the begin index, inclusive.<DD><CODE>endIndex</CODE> - the end index, exclusive.
|
|
<DT><B>Returns:</B><DD>the specified subsequence.
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if <tt>beginIndex</tt> or <tt>endIndex</tt> are negative,
|
|
if <tt>endIndex</tt> is greater than <tt>length()</tt>,
|
|
or if <tt>beginIndex</tt> is greater than <tt>startIndex</tt><DT><B>Since:</B></DT>
|
|
<DD>1.4</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="concat(java.lang.String)"><!-- --></A><H3>
|
|
concat</H3>
|
|
<PRE>
|
|
public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>concat</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str)</PRE>
|
|
<DL>
|
|
<DD>Concatenates the specified string to the end of this string.
|
|
<p>
|
|
If the length of the argument string is <code>0</code>, then this
|
|
<code>String</code> object is returned. Otherwise, a new
|
|
<code>String</code> object is created, representing a character
|
|
sequence that is the concatenation of the character sequence
|
|
represented by this <code>String</code> object and the character
|
|
sequence represented by the argument string.<p>
|
|
Examples:
|
|
<blockquote><pre>
|
|
"cares".concat("s") returns "caress"
|
|
"to".concat("get").concat("her") returns "together"
|
|
</pre></blockquote>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>str</CODE> - the <code>String</code> that is concatenated to the end
|
|
of this <code>String</code>.
|
|
<DT><B>Returns:</B><DD>a string that represents the concatenation of this object's
|
|
characters followed by the string argument's characters.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="replace(char, char)"><!-- --></A><H3>
|
|
replace</H3>
|
|
<PRE>
|
|
public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>replace</B>(char oldChar,
|
|
char newChar)</PRE>
|
|
<DL>
|
|
<DD>Returns a new string resulting from replacing all occurrences of
|
|
<code>oldChar</code> in this string with <code>newChar</code>.
|
|
<p>
|
|
If the character <code>oldChar</code> does not occur in the
|
|
character sequence represented by this <code>String</code> object,
|
|
then a reference to this <code>String</code> object is returned.
|
|
Otherwise, a new <code>String</code> object is created that
|
|
represents a character sequence identical to the character sequence
|
|
represented by this <code>String</code> object, except that every
|
|
occurrence of <code>oldChar</code> is replaced by an occurrence
|
|
of <code>newChar</code>.
|
|
<p>
|
|
Examples:
|
|
<blockquote><pre>
|
|
"mesquite in your cellar".replace('e', 'o')
|
|
returns "mosquito in your collar"
|
|
"the war of baronets".replace('r', 'y')
|
|
returns "the way of bayonets"
|
|
"sparring with a purple porpoise".replace('p', 't')
|
|
returns "starring with a turtle tortoise"
|
|
"JonL".replace('q', 'x') returns "JonL" (no change)
|
|
</pre></blockquote>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>oldChar</CODE> - the old character.<DD><CODE>newChar</CODE> - the new character.
|
|
<DT><B>Returns:</B><DD>a string derived from this string by replacing every
|
|
occurrence of <code>oldChar</code> with <code>newChar</code>.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="matches(java.lang.String)"><!-- --></A><H3>
|
|
matches</H3>
|
|
<PRE>
|
|
public boolean <B>matches</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex)</PRE>
|
|
<DL>
|
|
<DD>Tells whether or not this string matches the given <a
|
|
href="../util/regex/Pattern.html#sum">regular expression</a>.
|
|
|
|
<p> An invocation of this method of the form
|
|
<i>str</i><tt>.matches(</tt><i>regex</i><tt>)</tt> yields exactly the
|
|
same result as the expression
|
|
|
|
<blockquote><tt> <A HREF="../../java/util/regex/Pattern.html" title="class in java.util.regex"><CODE>Pattern</CODE></A>.<A HREF="../../java/util/regex/Pattern.html#matches(java.lang.String, java.lang.CharSequence)"><CODE>matches</CODE></A>(</tt><i>regex</i><tt>,</tt> <i>str</i><tt>)</tt></blockquote>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>regex</CODE> - the regular expression to which this string is to be matched
|
|
<DT><B>Returns:</B><DD><tt>true</tt> if, and only if, this string matches the
|
|
given regular expression
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/util/regex/PatternSyntaxException.html" title="class in java.util.regex">PatternSyntaxException</A></CODE> - if the regular expression's syntax is invalid<DT><B>Since:</B></DT>
|
|
<DD>1.4</DD>
|
|
<DT><B>See Also:</B><DD><A HREF="../../java/util/regex/Pattern.html" title="class in java.util.regex"><CODE>Pattern</CODE></A></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="contains(java.lang.CharSequence)"><!-- --></A><H3>
|
|
contains</H3>
|
|
<PRE>
|
|
public boolean <B>contains</B>(<A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A> s)</PRE>
|
|
<DL>
|
|
<DD>Returns true if and only if this string contains the specified
|
|
sequence of char values.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>s</CODE> - the sequence to search for
|
|
<DT><B>Returns:</B><DD>true if this string contains <code>s</code>, false otherwise
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/lang/NullPointerException.html" title="class in java.lang">NullPointerException</A></CODE> - if <code>s</code> is <code>null</code><DT><B>Since:</B></DT>
|
|
<DD>1.5</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="replaceFirst(java.lang.String, java.lang.String)"><!-- --></A><H3>
|
|
replaceFirst</H3>
|
|
<PRE>
|
|
public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>replaceFirst</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex,
|
|
<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> replacement)</PRE>
|
|
<DL>
|
|
<DD>Replaces the first substring of this string that matches the given <a
|
|
href="../util/regex/Pattern.html#sum">regular expression</a> with the
|
|
given replacement.
|
|
|
|
<p> An invocation of this method of the form
|
|
<i>str</i><tt>.replaceFirst(</tt><i>regex</i><tt>,</tt> <i>repl</i><tt>)</tt>
|
|
yields exactly the same result as the expression
|
|
|
|
<blockquote><tt>
|
|
<A HREF="../../java/util/regex/Pattern.html" title="class in java.util.regex"><CODE>Pattern</CODE></A>.<A HREF="../../java/util/regex/Pattern.html#compile(java.lang.String)"><CODE>compile</CODE></A>(</tt><i>regex</i><tt>).<A HREF="../../java/util/regex/Pattern.html#matcher(java.lang.CharSequence)"><CODE>matcher</CODE></A>(</tt><i>str</i><tt>).<A HREF="../../java/util/regex/Matcher.html#replaceFirst(java.lang.String)"><CODE>replaceFirst</CODE></A>(</tt><i>repl</i><tt>)</tt></blockquote>
|
|
|
|
<p>
|
|
Note that backslashes (<tt>\</tt>) and dollar signs (<tt>$</tt>) in the
|
|
replacement string may cause the results to be different than if it were
|
|
being treated as a literal replacement string; see
|
|
<A HREF="../../java/util/regex/Matcher.html#replaceFirst(java.lang.String)"><CODE>Matcher.replaceFirst(java.lang.String)</CODE></A>.
|
|
Use <A HREF="../../java/util/regex/Matcher.html#quoteReplacement(java.lang.String)"><CODE>Matcher.quoteReplacement(java.lang.String)</CODE></A> to suppress the special
|
|
meaning of these characters, if desired.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>regex</CODE> - the regular expression to which this string is to be matched<DD><CODE>replacement</CODE> - the string to be substituted for the first match
|
|
<DT><B>Returns:</B><DD>The resulting <tt>String</tt>
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/util/regex/PatternSyntaxException.html" title="class in java.util.regex">PatternSyntaxException</A></CODE> - if the regular expression's syntax is invalid<DT><B>Since:</B></DT>
|
|
<DD>1.4</DD>
|
|
<DT><B>See Also:</B><DD><A HREF="../../java/util/regex/Pattern.html" title="class in java.util.regex"><CODE>Pattern</CODE></A></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="replaceAll(java.lang.String, java.lang.String)"><!-- --></A><H3>
|
|
replaceAll</H3>
|
|
<PRE>
|
|
public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>replaceAll</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex,
|
|
<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> replacement)</PRE>
|
|
<DL>
|
|
<DD>Replaces each substring of this string that matches the given <a
|
|
href="../util/regex/Pattern.html#sum">regular expression</a> with the
|
|
given replacement.
|
|
|
|
<p> An invocation of this method of the form
|
|
<i>str</i><tt>.replaceAll(</tt><i>regex</i><tt>,</tt> <i>repl</i><tt>)</tt>
|
|
yields exactly the same result as the expression
|
|
|
|
<blockquote><tt>
|
|
<A HREF="../../java/util/regex/Pattern.html" title="class in java.util.regex"><CODE>Pattern</CODE></A>.<A HREF="../../java/util/regex/Pattern.html#compile(java.lang.String)"><CODE>compile</CODE></A>(</tt><i>regex</i><tt>).<A HREF="../../java/util/regex/Pattern.html#matcher(java.lang.CharSequence)"><CODE>matcher</CODE></A>(</tt><i>str</i><tt>).<A HREF="../../java/util/regex/Matcher.html#replaceAll(java.lang.String)"><CODE>replaceAll</CODE></A>(</tt><i>repl</i><tt>)</tt></blockquote>
|
|
|
|
<p>
|
|
Note that backslashes (<tt>\</tt>) and dollar signs (<tt>$</tt>) in the
|
|
replacement string may cause the results to be different than if it were
|
|
being treated as a literal replacement string; see
|
|
<A HREF="../../java/util/regex/Matcher.html#replaceAll(java.lang.String)"><CODE>Matcher.replaceAll</CODE></A>.
|
|
Use <A HREF="../../java/util/regex/Matcher.html#quoteReplacement(java.lang.String)"><CODE>Matcher.quoteReplacement(java.lang.String)</CODE></A> to suppress the special
|
|
meaning of these characters, if desired.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>regex</CODE> - the regular expression to which this string is to be matched<DD><CODE>replacement</CODE> - the string to be substituted for each match
|
|
<DT><B>Returns:</B><DD>The resulting <tt>String</tt>
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/util/regex/PatternSyntaxException.html" title="class in java.util.regex">PatternSyntaxException</A></CODE> - if the regular expression's syntax is invalid<DT><B>Since:</B></DT>
|
|
<DD>1.4</DD>
|
|
<DT><B>See Also:</B><DD><A HREF="../../java/util/regex/Pattern.html" title="class in java.util.regex"><CODE>Pattern</CODE></A></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="replace(java.lang.CharSequence, java.lang.CharSequence)"><!-- --></A><H3>
|
|
replace</H3>
|
|
<PRE>
|
|
public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>replace</B>(<A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A> target,
|
|
<A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A> replacement)</PRE>
|
|
<DL>
|
|
<DD>Replaces each substring of this string that matches the literal target
|
|
sequence with the specified literal replacement sequence. The
|
|
replacement proceeds from the beginning of the string to the end, for
|
|
example, replacing "aa" with "b" in the string "aaa" will result in
|
|
"ba" rather than "ab".
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>target</CODE> - The sequence of char values to be replaced<DD><CODE>replacement</CODE> - The replacement sequence of char values
|
|
<DT><B>Returns:</B><DD>The resulting string
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/lang/NullPointerException.html" title="class in java.lang">NullPointerException</A></CODE> - if <code>target</code> or
|
|
<code>replacement</code> is <code>null</code>.<DT><B>Since:</B></DT>
|
|
<DD>1.5</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="split(java.lang.String, int)"><!-- --></A><H3>
|
|
split</H3>
|
|
<PRE>
|
|
public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A>[] <B>split</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex,
|
|
int limit)</PRE>
|
|
<DL>
|
|
<DD>Splits this string around matches of the given
|
|
<a href="../util/regex/Pattern.html#sum">regular expression</a>.
|
|
|
|
<p> The array returned by this method contains each substring of this
|
|
string that is terminated by another substring that matches the given
|
|
expression or is terminated by the end of the string. The substrings in
|
|
the array are in the order in which they occur in this string. If the
|
|
expression does not match any part of the input then the resulting array
|
|
has just one element, namely this string.
|
|
|
|
<p> The <tt>limit</tt> parameter controls the number of times the
|
|
pattern is applied and therefore affects the length of the resulting
|
|
array. If the limit <i>n</i> is greater than zero then the pattern
|
|
will be applied at most <i>n</i> - 1 times, the array's
|
|
length will be no greater than <i>n</i>, and the array's last entry
|
|
will contain all input beyond the last matched delimiter. If <i>n</i>
|
|
is non-positive then the pattern will be applied as many times as
|
|
possible and the array can have any length. If <i>n</i> is zero then
|
|
the pattern will be applied as many times as possible, the array can
|
|
have any length, and trailing empty strings will be discarded.
|
|
|
|
<p> The string <tt>"boo:and:foo"</tt>, for example, yields the
|
|
following results with these parameters:
|
|
|
|
<blockquote><table cellpadding=1 cellspacing=0 summary="Split example showing regex, limit, and result">
|
|
<tr>
|
|
<th>Regex</th>
|
|
<th>Limit</th>
|
|
<th>Result</th>
|
|
</tr>
|
|
<tr><td align=center>:</td>
|
|
<td align=center>2</td>
|
|
<td><tt>{ "boo", "and:foo" }</tt></td></tr>
|
|
<tr><td align=center>:</td>
|
|
<td align=center>5</td>
|
|
<td><tt>{ "boo", "and", "foo" }</tt></td></tr>
|
|
<tr><td align=center>:</td>
|
|
<td align=center>-2</td>
|
|
<td><tt>{ "boo", "and", "foo" }</tt></td></tr>
|
|
<tr><td align=center>o</td>
|
|
<td align=center>5</td>
|
|
<td><tt>{ "b", "", ":and:f", "", "" }</tt></td></tr>
|
|
<tr><td align=center>o</td>
|
|
<td align=center>-2</td>
|
|
<td><tt>{ "b", "", ":and:f", "", "" }</tt></td></tr>
|
|
<tr><td align=center>o</td>
|
|
<td align=center>0</td>
|
|
<td><tt>{ "b", "", ":and:f" }</tt></td></tr>
|
|
</table></blockquote>
|
|
|
|
<p> An invocation of this method of the form
|
|
<i>str.</i><tt>split(</tt><i>regex</i><tt>,</tt> <i>n</i><tt>)</tt>
|
|
yields the same result as the expression
|
|
|
|
<blockquote>
|
|
<A HREF="../../java/util/regex/Pattern.html" title="class in java.util.regex"><CODE>Pattern</CODE></A>.<A HREF="../../java/util/regex/Pattern.html#compile(java.lang.String)"><CODE>compile</CODE></A><tt>(</tt><i>regex</i><tt>)</tt>.<A HREF="../../java/util/regex/Pattern.html#split(java.lang.CharSequence, int)"><CODE>split</CODE></A><tt>(</tt><i>str</i><tt>,</tt> <i>n</i><tt>)</tt>
|
|
</blockquote>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>regex</CODE> - the delimiting regular expression<DD><CODE>limit</CODE> - the result threshold, as described above
|
|
<DT><B>Returns:</B><DD>the array of strings computed by splitting this string
|
|
around matches of the given regular expression
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/util/regex/PatternSyntaxException.html" title="class in java.util.regex">PatternSyntaxException</A></CODE> - if the regular expression's syntax is invalid<DT><B>Since:</B></DT>
|
|
<DD>1.4</DD>
|
|
<DT><B>See Also:</B><DD><A HREF="../../java/util/regex/Pattern.html" title="class in java.util.regex"><CODE>Pattern</CODE></A></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="split(java.lang.String)"><!-- --></A><H3>
|
|
split</H3>
|
|
<PRE>
|
|
public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A>[] <B>split</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex)</PRE>
|
|
<DL>
|
|
<DD>Splits this string around matches of the given <a
|
|
href="../util/regex/Pattern.html#sum">regular expression</a>.
|
|
|
|
<p> This method works as if by invoking the two-argument <A HREF="../../java/lang/String.html#split(java.lang.String, int)"><CODE>split</CODE></A> method with the given expression and a limit
|
|
argument of zero. Trailing empty strings are therefore not included in
|
|
the resulting array.
|
|
|
|
<p> The string <tt>"boo:and:foo"</tt>, for example, yields the following
|
|
results with these expressions:
|
|
|
|
<blockquote><table cellpadding=1 cellspacing=0 summary="Split examples showing regex and result">
|
|
<tr>
|
|
<th>Regex</th>
|
|
<th>Result</th>
|
|
</tr>
|
|
<tr><td align=center>:</td>
|
|
<td><tt>{ "boo", "and", "foo" }</tt></td></tr>
|
|
<tr><td align=center>o</td>
|
|
<td><tt>{ "b", "", ":and:f" }</tt></td></tr>
|
|
</table></blockquote>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>regex</CODE> - the delimiting regular expression
|
|
<DT><B>Returns:</B><DD>the array of strings computed by splitting this string
|
|
around matches of the given regular expression
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/util/regex/PatternSyntaxException.html" title="class in java.util.regex">PatternSyntaxException</A></CODE> - if the regular expression's syntax is invalid<DT><B>Since:</B></DT>
|
|
<DD>1.4</DD>
|
|
<DT><B>See Also:</B><DD><A HREF="../../java/util/regex/Pattern.html" title="class in java.util.regex"><CODE>Pattern</CODE></A></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="toLowerCase(java.util.Locale)"><!-- --></A><H3>
|
|
toLowerCase</H3>
|
|
<PRE>
|
|
public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>toLowerCase</B>(<A HREF="../../java/util/Locale.html" title="class in java.util">Locale</A> locale)</PRE>
|
|
<DL>
|
|
<DD>Converts all of the characters in this <code>String</code> to lower
|
|
case using the rules of the given <code>Locale</code>. Case mapping is based
|
|
on the Unicode Standard version specified by the <A HREF="../../java/lang/Character.html" title="class in java.lang"><CODE>Character</CODE></A>
|
|
class. Since case mappings are not always 1:1 char mappings, the resulting
|
|
<code>String</code> may be a different length than the original <code>String</code>.
|
|
<p>
|
|
Examples of lowercase mappings are in the following table:
|
|
<table border="1" summary="Lowercase mapping examples showing language code of locale, upper case, lower case, and description">
|
|
<tr>
|
|
<th>Language Code of Locale</th>
|
|
<th>Upper Case</th>
|
|
<th>Lower Case</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
<tr>
|
|
<td>tr (Turkish)</td>
|
|
<td>\u0130</td>
|
|
<td>\u0069</td>
|
|
<td>capital letter I with dot above -> small letter i</td>
|
|
</tr>
|
|
<tr>
|
|
<td>tr (Turkish)</td>
|
|
<td>\u0049</td>
|
|
<td>\u0131</td>
|
|
<td>capital letter I -> small letter dotless i </td>
|
|
</tr>
|
|
<tr>
|
|
<td>(all)</td>
|
|
<td>French Fries</td>
|
|
<td>french fries</td>
|
|
<td>lowercased all chars in String</td>
|
|
</tr>
|
|
<tr>
|
|
<td>(all)</td>
|
|
<td><img src="doc-files/capiota.gif" alt="capiota"><img src="doc-files/capchi.gif" alt="capchi">
|
|
<img src="doc-files/captheta.gif" alt="captheta"><img src="doc-files/capupsil.gif" alt="capupsil">
|
|
<img src="doc-files/capsigma.gif" alt="capsigma"></td>
|
|
<td><img src="doc-files/iota.gif" alt="iota"><img src="doc-files/chi.gif" alt="chi">
|
|
<img src="doc-files/theta.gif" alt="theta"><img src="doc-files/upsilon.gif" alt="upsilon">
|
|
<img src="doc-files/sigma1.gif" alt="sigma"></td>
|
|
<td>lowercased all chars in String</td>
|
|
</tr>
|
|
</table>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>locale</CODE> - use the case transformation rules for this locale
|
|
<DT><B>Returns:</B><DD>the <code>String</code>, converted to lowercase.<DT><B>Since:</B></DT>
|
|
<DD>1.1</DD>
|
|
<DT><B>See Also:</B><DD><A HREF="../../java/lang/String.html#toLowerCase()"><CODE>toLowerCase()</CODE></A>,
|
|
<A HREF="../../java/lang/String.html#toUpperCase()"><CODE>toUpperCase()</CODE></A>,
|
|
<A HREF="../../java/lang/String.html#toUpperCase(java.util.Locale)"><CODE>toUpperCase(Locale)</CODE></A></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="toLowerCase()"><!-- --></A><H3>
|
|
toLowerCase</H3>
|
|
<PRE>
|
|
public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>toLowerCase</B>()</PRE>
|
|
<DL>
|
|
<DD>Converts all of the characters in this <code>String</code> to lower
|
|
case using the rules of the default locale. This is equivalent to calling
|
|
<code>toLowerCase(Locale.getDefault())</code>.
|
|
<p>
|
|
<b>Note:</b> This method is locale sensitive, and may produce unexpected
|
|
results if used for strings that are intended to be interpreted locale
|
|
independently.
|
|
Examples are programming language identifiers, protocol keys, and HTML
|
|
tags.
|
|
For instance, <code>"TITLE".toLowerCase()</code> in a Turkish locale
|
|
returns <code>"t?tle"</code>, where '?' is the LATIN SMALL
|
|
LETTER DOTLESS I character.
|
|
To obtain correct results for locale insensitive strings, use
|
|
<code>toLowerCase(Locale.ENGLISH)</code>.
|
|
<p>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>the <code>String</code>, converted to lowercase.<DT><B>See Also:</B><DD><A HREF="../../java/lang/String.html#toLowerCase(java.util.Locale)"><CODE>toLowerCase(Locale)</CODE></A></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="toUpperCase(java.util.Locale)"><!-- --></A><H3>
|
|
toUpperCase</H3>
|
|
<PRE>
|
|
public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>toUpperCase</B>(<A HREF="../../java/util/Locale.html" title="class in java.util">Locale</A> locale)</PRE>
|
|
<DL>
|
|
<DD>Converts all of the characters in this <code>String</code> to upper
|
|
case using the rules of the given <code>Locale</code>. Case mapping is based
|
|
on the Unicode Standard version specified by the <A HREF="../../java/lang/Character.html" title="class in java.lang"><CODE>Character</CODE></A>
|
|
class. Since case mappings are not always 1:1 char mappings, the resulting
|
|
<code>String</code> may be a different length than the original <code>String</code>.
|
|
<p>
|
|
Examples of locale-sensitive and 1:M case mappings are in the following table.
|
|
<p>
|
|
<table border="1" summary="Examples of locale-sensitive and 1:M case mappings. Shows Language code of locale, lower case, upper case, and description.">
|
|
<tr>
|
|
<th>Language Code of Locale</th>
|
|
<th>Lower Case</th>
|
|
<th>Upper Case</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
<tr>
|
|
<td>tr (Turkish)</td>
|
|
<td>\u0069</td>
|
|
<td>\u0130</td>
|
|
<td>small letter i -> capital letter I with dot above</td>
|
|
</tr>
|
|
<tr>
|
|
<td>tr (Turkish)</td>
|
|
<td>\u0131</td>
|
|
<td>\u0049</td>
|
|
<td>small letter dotless i -> capital letter I</td>
|
|
</tr>
|
|
<tr>
|
|
<td>(all)</td>
|
|
<td>\u00df</td>
|
|
<td>\u0053 \u0053</td>
|
|
<td>small letter sharp s -> two letters: SS</td>
|
|
</tr>
|
|
<tr>
|
|
<td>(all)</td>
|
|
<td>Fahrvergnügen</td>
|
|
<td>FAHRVERGNÜGEN</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>locale</CODE> - use the case transformation rules for this locale
|
|
<DT><B>Returns:</B><DD>the <code>String</code>, converted to uppercase.<DT><B>Since:</B></DT>
|
|
<DD>1.1</DD>
|
|
<DT><B>See Also:</B><DD><A HREF="../../java/lang/String.html#toUpperCase()"><CODE>toUpperCase()</CODE></A>,
|
|
<A HREF="../../java/lang/String.html#toLowerCase()"><CODE>toLowerCase()</CODE></A>,
|
|
<A HREF="../../java/lang/String.html#toLowerCase(java.util.Locale)"><CODE>toLowerCase(Locale)</CODE></A></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="toUpperCase()"><!-- --></A><H3>
|
|
toUpperCase</H3>
|
|
<PRE>
|
|
public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>toUpperCase</B>()</PRE>
|
|
<DL>
|
|
<DD>Converts all of the characters in this <code>String</code> to upper
|
|
case using the rules of the default locale. This method is equivalent to
|
|
<code>toUpperCase(Locale.getDefault())</code>.
|
|
<p>
|
|
<b>Note:</b> This method is locale sensitive, and may produce unexpected
|
|
results if used for strings that are intended to be interpreted locale
|
|
independently.
|
|
Examples are programming language identifiers, protocol keys, and HTML
|
|
tags.
|
|
For instance, <code>"title".toUpperCase()</code> in a Turkish locale
|
|
returns <code>"T?TLE"</code>, where '?' is the LATIN CAPITAL
|
|
LETTER I WITH DOT ABOVE character.
|
|
To obtain correct results for locale insensitive strings, use
|
|
<code>toUpperCase(Locale.ENGLISH)</code>.
|
|
<p>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>the <code>String</code>, converted to uppercase.<DT><B>See Also:</B><DD><A HREF="../../java/lang/String.html#toUpperCase(java.util.Locale)"><CODE>toUpperCase(Locale)</CODE></A></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="trim()"><!-- --></A><H3>
|
|
trim</H3>
|
|
<PRE>
|
|
public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>trim</B>()</PRE>
|
|
<DL>
|
|
<DD>Returns a copy of the string, with leading and trailing whitespace
|
|
omitted.
|
|
<p>
|
|
If this <code>String</code> object represents an empty character
|
|
sequence, or the first and last characters of character sequence
|
|
represented by this <code>String</code> object both have codes
|
|
greater than <code>'\u0020'</code> (the space character), then a
|
|
reference to this <code>String</code> object is returned.
|
|
<p>
|
|
Otherwise, if there is no character with a code greater than
|
|
<code>'\u0020'</code> in the string, then a new
|
|
<code>String</code> object representing an empty string is created
|
|
and returned.
|
|
<p>
|
|
Otherwise, let <i>k</i> be the index of the first character in the
|
|
string whose code is greater than <code>'\u0020'</code>, and let
|
|
<i>m</i> be the index of the last character in the string whose code
|
|
is greater than <code>'\u0020'</code>. A new <code>String</code>
|
|
object is created, representing the substring of this string that
|
|
begins with the character at index <i>k</i> and ends with the
|
|
character at index <i>m</i>-that is, the result of
|
|
<code>this.substring(<i>k</i>, <i>m</i>+1)</code>.
|
|
<p>
|
|
This method may be used to trim whitespace (as defined above) from
|
|
the beginning and end of a string.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>A copy of this string with leading and trailing white
|
|
space removed, or this string if it has no leading or
|
|
trailing white space.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="toString()"><!-- --></A><H3>
|
|
toString</H3>
|
|
<PRE>
|
|
public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>toString</B>()</PRE>
|
|
<DL>
|
|
<DD>This object (which is already a string!) is itself returned.
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Specified by:</B><DD><CODE><A HREF="../../java/lang/CharSequence.html#toString()">toString</A></CODE> in interface <CODE><A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A></CODE><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#toString()">toString</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></CODE></DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>the string itself.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="toCharArray()"><!-- --></A><H3>
|
|
toCharArray</H3>
|
|
<PRE>
|
|
public char[] <B>toCharArray</B>()</PRE>
|
|
<DL>
|
|
<DD>Converts this string to a new character array.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>a newly allocated character array whose length is the length
|
|
of this string and whose contents are initialized to contain
|
|
the character sequence represented by this string.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="format(java.lang.String, java.lang.Object...)"><!-- --></A><H3>
|
|
format</H3>
|
|
<PRE>
|
|
public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>format</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> format,
|
|
<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A>... args)</PRE>
|
|
<DL>
|
|
<DD>Returns a formatted string using the specified format string and
|
|
arguments.
|
|
|
|
<p> The locale always used is the one returned by <A HREF="../../java/util/Locale.html#getDefault()"><CODE>Locale.getDefault()</CODE></A>.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>format</CODE> - A <a href="../util/Formatter.html#syntax">format string</a><DD><CODE>args</CODE> - Arguments referenced by the format specifiers in the format
|
|
string. If there are more arguments than format specifiers, the
|
|
extra arguments are ignored. The number of arguments is
|
|
variable and may be zero. The maximum number of arguments is
|
|
limited by the maximum dimension of a Java array as defined by
|
|
the <a href="http://java.sun.com/docs/books/vmspec/">Java
|
|
Virtual Machine Specification</a>. The behaviour on a
|
|
<tt>null</tt> argument depends on the <a
|
|
href="../util/Formatter.html#syntax">conversion</a>.
|
|
<DT><B>Returns:</B><DD>A formatted string
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE>IllegalFormatException</CODE> - If a format string contains an illegal syntax, a format
|
|
specifier that is incompatible with the given arguments,
|
|
insufficient arguments given the format string, or other
|
|
illegal conditions. For specification of all possible
|
|
formatting errors, see the <a
|
|
href="../util/Formatter.html#detail">Details</a> section of the
|
|
formatter class specification.
|
|
<DD><CODE><A HREF="../../java/lang/NullPointerException.html" title="class in java.lang">NullPointerException</A></CODE> - If the <tt>format</tt> is <tt>null</tt><DT><B>Since:</B></DT>
|
|
<DD>1.5</DD>
|
|
<DT><B>See Also:</B><DD><A HREF="../../java/util/Formatter.html" title="class in java.util"><CODE>Formatter</CODE></A></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="format(java.util.Locale, java.lang.String, java.lang.Object...)"><!-- --></A><H3>
|
|
format</H3>
|
|
<PRE>
|
|
public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>format</B>(<A HREF="../../java/util/Locale.html" title="class in java.util">Locale</A> l,
|
|
<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> format,
|
|
<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A>... args)</PRE>
|
|
<DL>
|
|
<DD>Returns a formatted string using the specified locale, format string,
|
|
and arguments.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>l</CODE> - The <A HREF="../../java/util/Locale.html" title="class in java.util">locale</A> to apply during
|
|
formatting. If <tt>l</tt> is <tt>null</tt> then no localization
|
|
is applied.<DD><CODE>format</CODE> - A <a href="../util/Formatter.html#syntax">format string</a><DD><CODE>args</CODE> - Arguments referenced by the format specifiers in the format
|
|
string. If there are more arguments than format specifiers, the
|
|
extra arguments are ignored. The number of arguments is
|
|
variable and may be zero. The maximum number of arguments is
|
|
limited by the maximum dimension of a Java array as defined by
|
|
the <a href="http://java.sun.com/docs/books/vmspec/">Java
|
|
Virtual Machine Specification</a>. The behaviour on a
|
|
<tt>null</tt> argument depends on the <a
|
|
href="../util/Formatter.html#syntax">conversion</a>.
|
|
<DT><B>Returns:</B><DD>A formatted string
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE>IllegalFormatException</CODE> - If a format string contains an illegal syntax, a format
|
|
specifier that is incompatible with the given arguments,
|
|
insufficient arguments given the format string, or other
|
|
illegal conditions. For specification of all possible
|
|
formatting errors, see the <a
|
|
href="../util/Formatter.html#detail">Details</a> section of the
|
|
formatter class specification
|
|
<DD><CODE><A HREF="../../java/lang/NullPointerException.html" title="class in java.lang">NullPointerException</A></CODE> - If the <tt>format</tt> is <tt>null</tt><DT><B>Since:</B></DT>
|
|
<DD>1.5</DD>
|
|
<DT><B>See Also:</B><DD><A HREF="../../java/util/Formatter.html" title="class in java.util"><CODE>Formatter</CODE></A></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="valueOf(java.lang.Object)"><!-- --></A><H3>
|
|
valueOf</H3>
|
|
<PRE>
|
|
public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>valueOf</B>(<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A> obj)</PRE>
|
|
<DL>
|
|
<DD>Returns the string representation of the <code>Object</code> argument.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>obj</CODE> - an <code>Object</code>.
|
|
<DT><B>Returns:</B><DD>if the argument is <code>null</code>, then a string equal to
|
|
<code>"null"</code>; otherwise, the value of
|
|
<code>obj.toString()</code> is returned.<DT><B>See Also:</B><DD><A HREF="../../java/lang/Object.html#toString()"><CODE>Object.toString()</CODE></A></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="valueOf(char[])"><!-- --></A><H3>
|
|
valueOf</H3>
|
|
<PRE>
|
|
public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>valueOf</B>(char[] data)</PRE>
|
|
<DL>
|
|
<DD>Returns the string representation of the <code>char</code> array
|
|
argument. The contents of the character array are copied; subsequent
|
|
modification of the character array does not affect the newly
|
|
created string.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>data</CODE> - a <code>char</code> array.
|
|
<DT><B>Returns:</B><DD>a newly allocated string representing the same sequence of
|
|
characters contained in the character array argument.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="valueOf(char[], int, int)"><!-- --></A><H3>
|
|
valueOf</H3>
|
|
<PRE>
|
|
public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>valueOf</B>(char[] data,
|
|
int offset,
|
|
int count)</PRE>
|
|
<DL>
|
|
<DD>Returns the string representation of a specific subarray of the
|
|
<code>char</code> array argument.
|
|
<p>
|
|
The <code>offset</code> argument is the index of the first
|
|
character of the subarray. The <code>count</code> argument
|
|
specifies the length of the subarray. The contents of the subarray
|
|
are copied; subsequent modification of the character array does not
|
|
affect the newly created string.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>data</CODE> - the character array.<DD><CODE>offset</CODE> - the initial offset into the value of the
|
|
<code>String</code>.<DD><CODE>count</CODE> - the length of the value of the <code>String</code>.
|
|
<DT><B>Returns:</B><DD>a string representing the sequence of characters contained
|
|
in the subarray of the character array argument.
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if <code>offset</code> is
|
|
negative, or <code>count</code> is negative, or
|
|
<code>offset+count</code> is larger than
|
|
<code>data.length</code>.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="copyValueOf(char[], int, int)"><!-- --></A><H3>
|
|
copyValueOf</H3>
|
|
<PRE>
|
|
public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>copyValueOf</B>(char[] data,
|
|
int offset,
|
|
int count)</PRE>
|
|
<DL>
|
|
<DD>Returns a String that represents the character sequence in the
|
|
array specified.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>data</CODE> - the character array.<DD><CODE>offset</CODE> - initial offset of the subarray.<DD><CODE>count</CODE> - length of the subarray.
|
|
<DT><B>Returns:</B><DD>a <code>String</code> that contains the characters of the
|
|
specified subarray of the character array.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="copyValueOf(char[])"><!-- --></A><H3>
|
|
copyValueOf</H3>
|
|
<PRE>
|
|
public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>copyValueOf</B>(char[] data)</PRE>
|
|
<DL>
|
|
<DD>Returns a String that represents the character sequence in the
|
|
array specified.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>data</CODE> - the character array.
|
|
<DT><B>Returns:</B><DD>a <code>String</code> that contains the characters of the
|
|
character array.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="valueOf(boolean)"><!-- --></A><H3>
|
|
valueOf</H3>
|
|
<PRE>
|
|
public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>valueOf</B>(boolean b)</PRE>
|
|
<DL>
|
|
<DD>Returns the string representation of the <code>boolean</code> argument.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>b</CODE> - a <code>boolean</code>.
|
|
<DT><B>Returns:</B><DD>if the argument is <code>true</code>, a string equal to
|
|
<code>"true"</code> is returned; otherwise, a string equal to
|
|
<code>"false"</code> is returned.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="valueOf(char)"><!-- --></A><H3>
|
|
valueOf</H3>
|
|
<PRE>
|
|
public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>valueOf</B>(char c)</PRE>
|
|
<DL>
|
|
<DD>Returns the string representation of the <code>char</code>
|
|
argument.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>c</CODE> - a <code>char</code>.
|
|
<DT><B>Returns:</B><DD>a string of length <code>1</code> containing
|
|
as its single character the argument <code>c</code>.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="valueOf(int)"><!-- --></A><H3>
|
|
valueOf</H3>
|
|
<PRE>
|
|
public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>valueOf</B>(int i)</PRE>
|
|
<DL>
|
|
<DD>Returns the string representation of the <code>int</code> argument.
|
|
<p>
|
|
The representation is exactly the one returned by the
|
|
<code>Integer.toString</code> method of one argument.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>i</CODE> - an <code>int</code>.
|
|
<DT><B>Returns:</B><DD>a string representation of the <code>int</code> argument.<DT><B>See Also:</B><DD><A HREF="../../java/lang/Integer.html#toString(int, int)"><CODE>Integer.toString(int, int)</CODE></A></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="valueOf(long)"><!-- --></A><H3>
|
|
valueOf</H3>
|
|
<PRE>
|
|
public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>valueOf</B>(long l)</PRE>
|
|
<DL>
|
|
<DD>Returns the string representation of the <code>long</code> argument.
|
|
<p>
|
|
The representation is exactly the one returned by the
|
|
<code>Long.toString</code> method of one argument.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>l</CODE> - a <code>long</code>.
|
|
<DT><B>Returns:</B><DD>a string representation of the <code>long</code> argument.<DT><B>See Also:</B><DD><A HREF="../../java/lang/Long.html#toString(long)"><CODE>Long.toString(long)</CODE></A></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="valueOf(float)"><!-- --></A><H3>
|
|
valueOf</H3>
|
|
<PRE>
|
|
public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>valueOf</B>(float f)</PRE>
|
|
<DL>
|
|
<DD>Returns the string representation of the <code>float</code> argument.
|
|
<p>
|
|
The representation is exactly the one returned by the
|
|
<code>Float.toString</code> method of one argument.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>f</CODE> - a <code>float</code>.
|
|
<DT><B>Returns:</B><DD>a string representation of the <code>float</code> argument.<DT><B>See Also:</B><DD><A HREF="../../java/lang/Float.html#toString(float)"><CODE>Float.toString(float)</CODE></A></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="valueOf(double)"><!-- --></A><H3>
|
|
valueOf</H3>
|
|
<PRE>
|
|
public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>valueOf</B>(double d)</PRE>
|
|
<DL>
|
|
<DD>Returns the string representation of the <code>double</code> argument.
|
|
<p>
|
|
The representation is exactly the one returned by the
|
|
<code>Double.toString</code> method of one argument.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>d</CODE> - a <code>double</code>.
|
|
<DT><B>Returns:</B><DD>a string representation of the <code>double</code> argument.<DT><B>See Also:</B><DD><A HREF="../../java/lang/Double.html#toString(double)"><CODE>Double.toString(double)</CODE></A></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="intern()"><!-- --></A><H3>
|
|
intern</H3>
|
|
<PRE>
|
|
public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>intern</B>()</PRE>
|
|
<DL>
|
|
<DD>Returns a canonical representation for the string object.
|
|
<p>
|
|
A pool of strings, initially empty, is maintained privately by the
|
|
class <code>String</code>.
|
|
<p>
|
|
When the intern method is invoked, if the pool already contains a
|
|
string equal to this <code>String</code> object as determined by
|
|
the <A HREF="../../java/lang/String.html#equals(java.lang.Object)"><CODE>equals(Object)</CODE></A> method, then the string from the pool is
|
|
returned. Otherwise, this <code>String</code> object is added to the
|
|
pool and a reference to this <code>String</code> object is returned.
|
|
<p>
|
|
It follows that for any two strings <code>s</code> and <code>t</code>,
|
|
<code>s.intern() == t.intern()</code> is <code>true</code>
|
|
if and only if <code>s.equals(t)</code> is <code>true</code>.
|
|
<p>
|
|
All literal strings and string-valued constant expressions are
|
|
interned. String literals are defined in §3.10.5 of the
|
|
<a href="http://java.sun.com/docs/books/jls/html/">Java Language
|
|
Specification</a>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>a string that has the same contents as this string, but is
|
|
guaranteed to be from a pool of unique strings.</DL>
|
|
</DD>
|
|
</DL>
|
|
<!-- ========= END OF CLASS DATA ========= -->
|
|
<HR>
|
|
|
|
|
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
|
<A NAME="navbar_bottom"><!-- --></A>
|
|
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
|
|
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
|
<TR>
|
|
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
|
<A NAME="navbar_bottom_firstrow"><!-- --></A>
|
|
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
|
<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/String.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™ Platform<br>Standard Ed. 6</b></EM>
|
|
</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../java/lang/StrictMath.html" title="class in java.lang"><B>PREV CLASS</B></A>
|
|
<A HREF="../../java/lang/StringBuffer.html" title="class in java.lang"><B>NEXT CLASS</B></A></FONT></TD>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../index.html?java/lang/String.html" target="_top"><B>FRAMES</B></A>
|
|
<A HREF="String.html" target="_top"><B>NO FRAMES</B></A>
|
|
<SCRIPT type="text/javascript">
|
|
<!--
|
|
if(window==top) {
|
|
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
|
|
}
|
|
//-->
|
|
</SCRIPT>
|
|
<NOSCRIPT>
|
|
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
|
|
</NOSCRIPT>
|
|
|
|
|
|
</FONT></TD>
|
|
</TR>
|
|
<TR>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
|
|
</TR>
|
|
</TABLE>
|
|
<A NAME="skip-navbar_bottom"></A>
|
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
|
|
|
<HR>
|
|
<font size="-1"> <a href="http://bugs.sun.com/services/bugreport/index.jsp">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/javase/6/webnotes/devdocs-vs-specs.html">Java SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.<p> <a href="../../../legal/cpyr.html">Copyright</a> © 1993, 2011, Oracle and/or its affiliates. All rights reserved. </font>
|
|
<!-- Start SiteCatalyst code -->
|
|
<script language="JavaScript" src="http://www.oracle.com/ocom/groups/systemobject/@mktg_admin/documents/systemobject/s_code_download.js"></script>
|
|
<script language="JavaScript" src="http://www.oracle.com/ocom/groups/systemobject/@mktg_admin/documents/systemobject/s_code.js"></script>
|
|
|
|
<!-- ********** DO NOT ALTER ANYTHING BELOW THIS LINE ! *********** -->
|
|
<!-- Below code will send the info to Omniture server -->
|
|
<script language="javascript">var s_code=s.t();if(s_code)document.write(s_code)</script>
|
|
|
|
<!-- End SiteCatalyst code -->
|
|
<noscript>
|
|
<p>Scripting on this page tracks web page traffic, but does not change the content in any way.</p>
|
|
</noscript>
|
|
</BODY>
|
|
</HTML>
|