Skip to content

Instantly share code, notes, and snippets.

View SubhamTyagi's full-sized avatar
💭
Busy

Shubham SubhamTyagi

💭
Busy
  • INDIA(भारत)
View GitHub Profile
@SubhamTyagi
SubhamTyagi / FindingFullWord.java
Created September 12, 2018 14:49
This example is used to show the difference between 'regex search' and 'use of indexOf'
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class FindingFullWord {
public static void main(String[] args) {
String sentence="dia India dia dialog fadia dia";
String word="dia";
System.out.println("count by first method =="+simpleCount(word,sentence));//count by first method ==6