RegionMatches() Method in Java
The regionMatches() method for the String class has two variations that can be utilized to test assuming two string districts are coordinating or equivalent. There are two variations of this strategy, i.e., one is ignore case, and the other is case sensitive.
The regionMatches() method is utilized to test assuming two string districts are equivalent. A substring of this String object is contrasted with a substring of the contention other.
The outcome is true, assuming these substrings address character arrangements that are something similar, ignoring case if and provided that ignoreCase is true.The substring of this string object has the length of len, by ending at the ooffset and begins at the toffset.The outcome is false if and provided that no less than one of coming up next is true.
1. ignoreCase is false, and there is some nonnegative number i not exactly len with the end goal that:
2. ignoreCase is valid, and there is some nonnegative whole number i not exactly len with the end goal that:
4. toffset+len is larger than the length of this String object.
5. ooffset+len is more noteworthy than the length of the other contention.
6. If the toffset is negative.
7. If the ooffset is negative.
Syntax for RegionMatch() Method
Return value: Boolean
A substring of the String object is contrasted with a substring of the contention other. The outcome is valid, assuming these substrings address character groupings that are something very similar, overlooking case if and provided that ignoreCase is valid. The substring of the other to be analyzed starts at file ooffset and has length len. The outcome is bogus if and provided that somewhere around one of coming up next is valid.
Example Program on RegionMatches() Method by Case Sensitive
Example Program on RegionMatches() Method by Ignoring Case