
- Java Tutorial
- Java - Home
- Java - Overview
- Java - Environment Setup
- Java - Basic Syntax
- Java - Object & Classes
- Java - Constructors
- Java - Basic Datatypes
- Java - Variable Types
- Java - Modifier Types
- Java - Basic Operators
- Java - Loop Control
- Java - Decision Making
- Java - Numbers
- Java - Characters
- Java - Strings
- Java - Arrays
- Java - Date & Time
- Java - Regular Expressions
- Java - Methods
- Java - Files and I/O
- Java - Exceptions
- Java - Inner classes
- Java Object Oriented
- Java - Inheritance
- Java - Overriding
- Java - Polymorphism
- Java - Abstraction
- Java - Encapsulation
- Java - Interfaces
- Java - Packages
- Java Advanced
- Java - Data Structures
- Java - Collections
- Java - Generics
- Java - Serialization
- Java - Networking
- Java - Sending Email
- Java - Multithreading
- Java - Applet Basics
- Java - Documentation
- Java Useful Resources
- Java - Questions and Answers
- Java - Quick Guide
- Java - Useful Resources
- Java - Discussion
- Java - Examples
Java - String regionMatches() ignoreCase
Description
This method has two variants which can be used to test if two string regions are equal.
Syntax
Here is the syntax of this method −
public boolean regionMatches(boolean ignoreCase, int toffset, String other, int ooffset, int len)
Parameters
Here is the detail of 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.
ignoreCase − if true, ignore case when comparing characters.
Return Value
It 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.
Example
import java.io.*; public class Test { public static void main(String args[]) { String Str1 = new String("Welcome to Tutorialspoint.com"); String Str2 = new String("TUTORIALS"); System.out.print("Return Value :" ); System.out.println(Str1.regionMatches(true, 11, Str2, 0, 9)); } }
This will produce the following result −
Output
Return Value :true
java_strings.htm
Advertisements