String.regionMatches

String.regionMatches

Class Overview | Class Members | This Package | All Packages

Syntax 1
public boolean regionMatches( int toffset, String other, int ooffset, int len )
Parameters
toffset
the starting offset of the subregion in this string.
other
the string argument.
ooffset
the starting offset of the subregion in the string argument.
len
the number of characters to compare.
Returns
true if the specified subregion of this string exactly matches the specified subregion of the string argument; false otherwise.
Description
Tests if two string regions are equal.

If toffset or ooffset is negative, or if toffset+length is greater than the length of this string, or if ooffset+length is greater than the length of the string argument, then this method returns false.



Syntax 2
public boolean regionMatches( boolean ignoreCase, int toffset, String other, int ooffset, int len )
Parameters
ignoreCase
if true, ignore case when comparing characters.
toffset
the starting offset of the subregion in this string.
other
the string argument.
ooffset
the starting offset of the subregion in the string argument.
len
the number of characters to compare.
Returns
true if the specified subregion of this string matches the specified subregion of the string argument; false otherwise. Whether the matching is exact or case insensitive depends on the ignoreCase argument.
Description
Tests if two string regions are equal.

If toffset or ooffset is negative, or if toffset+length is greater than the length of this string, or if ooffset+length is greater than the length of the string argument, then this method returns false.