RegionMatches() Method in JavaThe 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: And 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
Parameters:
Return value: BooleanA 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 SensitiveOutput: Example Program on RegionMatches() Method by Ignoring CaseOutput: Next TopicRepaint() Method in Java |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India