Java Reference
In-Depth Information
Checking starts in this string at the position start , and in the
other string at position ostart . Only the first count characters
are compared.
public boolean regionMatches(boolean ignoreCase, int start, String
other, int ostart, int count)
This version of regionMatches behaves exactly like the previous
one, but the boolean ignoreCase controls whether case is sig-
nificant.
For example:
class RegionMatch {
public static void main(String[] args) {
String str = "Look, look!";
boolean b1, b2, b3;
b1 = str.regionMatches(6, "Look", 0, 4);
b2 = str.regionMatches(true, 6, "Look", 0, 4);
b3 = str.regionMatches(true, 6, "Look", 0, 5);
System.out.println("b1 = " + b1);
System.out.println("b2 = " + b2);
System.out.println("b3 = " + b3);
}
}
Here is its output:
b1 = false
b2 = true
b3 = false
 
Search WWH ::




Custom Search