This process has two variants, which can be utilized to test if two string districts are equal. lang. String. regionMatches(boolean ignoreCase, int toffset, String extra, int ooffset, int len) technique tests if two string districts are equal. A substring of this String object is contrasted to a substring of the argument other.
Here is the syntax of this method:
public boolean regionMatches(boolean ignoreCase, int toffset, String other, int ooffset, int len)
Here is the detail of parameters −
import java.io.*; public class Test { public static void main(String args[]) { String Str1 = new String("Welcome to Intellinuts.com"); String Str2 = new String("INTELLI"); System.out.print("Return Value :" ); System.out.println(Str1.regionMatches(true, 11, Str2, 0, 9)); } }
This will produce the following result:
Return Value :true
Here at Intellinuts, we have created a complete Java tutorial for Beginners to get started in Java.