Monday 14, Apr 2025
We are moved to new domain
Click -> www.ehowtonow.com
Friday, 8 May 2015

String Region match in Java

Following example shows how to determines region matches in two String using regionMatches() method.

Sample Program

01.package com.javatutorialcorner.javastring;
02. 
03.public class RegionMatches {
04. 
05.    public static void main(String[] args) {
06.        String input1 = "Spring tutorials @ Java Tutorials Corner";
07.        String input2 = "Learn Spring @ Java Tutorials Corner";
08.         
09.        boolean isMatched = input1.
10.                  regionMatches(24, input2, 20, 16);
11.        System.out.println();
12.        System.out.println(isMatched);
13.         
14.    }
15. 
16.}

Result


The above code checks region “Tutorials Corner” matches in both string .



true

Shop and help us

Flipkart Offer Snapdeal offer Amazon.in offer Amazon.com offer

Related Posts:

  • Blogger Comments
  • Facebook Comments
  • Disqus Comments

0 comments:

Post a Comment

Item Reviewed: String Region match in Java Rating: 5 Reviewed By: eHowToNow