20.12
java.lang.String
THE PACKAGE JAVA.LANG
20.12.17
public int compareTo(String anotherString)
throws NullPointerException
The character sequence represented by this
String
 object is compared lexico 
graphically to the character sequence represented by the argument string. The
result is a negative integer if this
String
 object lexicographically precedes the
argument string. The result is a positive integer if this
String
 object lexicograph 
ically follows the argument string. The result is zero if the strings are equal;
com 
pareTo
 returns
0
 exactly when the
equals
 method ( 20.12.9) would return
true
.
If
anotherString
 is
null
, then a
NullPointerException
 is thrown.
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
k
 be the smallest such index; then the string
whose character at position
k
 has the smaller value, as determined by using the
<
operator, lexicographically precedes the other string. In this case,
compareTo
returns the difference of the two character values at position
k
 in the two strings 
that is, the value:
this.charAt(k) anotherString.charAt(k)
If there is no index position at which they differ, then the shorter string lexico 
graphically precedes the longer string. In this case,
compareTo
 returns the differ 
ence of the lengths of the strings that is, the value:
this.length() anotherString.length()
20.12.18
public boolean regionMatches(int toffset,
String other, int ooffset, int len)
throws NullPointerException
A substring of this
String
 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
String
 object to be compared begins at index
toffset
 and has length
len
. The substring of
other
 to be compared begins at
index
ooffset
 and has length
len
. The result is
false
 if and only if at least one
of the following is true:
toffset
 is negative.
ooffset
 is negative.
toffset+len
 is greater than the length of this
String
 object.
538






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved