find and substring

Ads
 

find and substring

**import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Findandreplace { BufferedReader keybord=null;

public void findsubstring() {
    try {
    keybord=new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Enter find String");
    String findstring = keybord.readLine();
    String substring = keybord.readLine();
    findreplace(findstring,substring);

    } catch(IOException io){            
    }
}
public void findreplace(String find, String replace) {
    Pattern pattern = Pattern.compile(find);
    //CharSequence chsequence=replace;
    Matcher matcher = pattern.matcher(replace);
    StringBuffer sb = new StringBuffer();
    while (matcher.find()) {
        System.out.println(matcher.group(1));
       // matcher.appendReplacement(sb, replace);
    }
     //if(find.contains(replace){}----->
    /*String string = "I will come and meet you at the 123woods";
    String keyword = "123woods";
    Boolean found = Arrays.asList(string.split(" ")).contains(keyword);
    if(found){
          System.out.println("Keyword matched the string");
    }*/
    }

public static void main(String[] args) { Findandreplace substring = new Findandreplace(); substring.findsubstring(); } }**

View Answers

Ads









Related Tutorials/Questions & Answers:
find and substring
find and substring   **import java.io.BufferedReader; import... BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter find String"); String findstring = keybord.readLine(); String substring
find a substring by using I/O package
find a substring by using I/O package  Write a java program to find a sub string from given string by using I/O package
Advertisements
Java Substring
, how they can find the substring. To find the substring in Java there is method... this method to find out the substring from a given String. substring() method... which will demonstrate you about how to find out the substring of current
SubString help - Java Beginners
SubString help  Hi , I would appreciate if somebody could help me... a substring of 35 zeros '00000000000000000000000000000000000' and they could... substring . If it find 35 zeros i need 10 digits in front of it along with those
JavaScript indexOf substring
; In this section, we are going to find the location of substring using... JavaScript indexOf substring... the parameters substring is the specified string and 0 is the index
ModuleNotFoundError: No module named 'substring'
ModuleNotFoundError: No module named 'substring'  Hi, My Python... 'substring' How to remove the ModuleNotFoundError: No module named 'substring' error? Thanks   Hi, In your python environment you
How to substring in Java?
How to substring in Java?  Hi, I want to get a part of String in Java. How to substring in Java? Thanks   HI, Hi you can use the substring() method of Java for getting a part of string based on the index number
help with substring in c programing
help with substring in c programing  Hi I could not found programming.... Please help with substring function,prompt the user for two strings and display whether or not the second string is a substring of the first string. Regards
Search string using substring
Search string using substring  I want to print a string by searching a substring of that string. - i want to print email-ids from word files (resumes... find index position of @, that too in a single text file. import java.io.
String substring(int beginIndex)
. To find a substring from the specified string, we have applied substring(int... String substring(int beginIndex)   ... the substring(int beginIndex) method of String class. We are going to use
C Programming SubString Program
C Programming SubString Program  Sir I want to Check whether the Single Substring is present in the given 3 string. characters. eg if i entered First String- CPROGRAMMING Second String- CPROGRAM third String- PROGRAMMING if i
JavaScript substring length
JavaScript substring length...; This section illustrates you how to determine the length of substring in JavaScript. You... method substring() in order to extract the substring from  the defined
How to substring in JQuery?
How to substring in JQuery?  Hi, I my JQuery application I am getting the value from server using Ajax. I have to substring the value in jQuery.... Please let's know How to substring in JQuery? Thanks   Hi
How to check if a string contains a substring in iOS?
Function for checking the presence of a substring in a string (NSString) in iOS While writing the code for iOS based application you may have to find the presence of substring in a string (NSString) and there is no readymade function
SubString in Java
SubString(), a method of String class is used to get a part of original string.... This method has two types: SubString(int beginIndex): This method returns part.... If beginIndex is equal to length in SubString(int beginIndex) it will return empty String
C String Substring
C String Substring       In this section, you will learn how to get the substring from a string in C. You can see in the given example, a string and a method substring
String substring(int beginIndex, int endIndex)
. In the program code given below, we have taken a String. To find a substring from... String substring(int beginIndex, int endIndex)  ... explanation about the substring(int beginIndex, int endIndex) method of String
JPA Substring() Function
JPA Substring() Function       In this section, you will learn about the JPQL substring() function. The substring() function returns the some part of string arguments
C get Substring from String
C get Substring from String       This section illustrates you how to get the substring using library function. You can see in the given example, we have used the library
find the factorial
find the factorial  how to find the factorial through the while loop?   class FindFactorial { public static void main(String[] args) { int value = 5, factorial = 1, temp = value; while
Version of gj-find>gj-find dependency
List of Version of gj-find>gj-find dependency
PHP find online users
PHP find online users  How to find the online users in PHP
find and replace in java
find and replace in java  Need 'find and replace' function in Java to find special keyword in XMl such as @,#,!,%..and replace with their corresponding entities
Use of <fn:subString(String, int, int)> Tag of JSTL
Use of <fn:subString(String, int, int)> Tag of JSTL... and return string type. Syntax : java.lang.String substring(java.lang.String, int, int)           subString
ModuleNotFoundError: No module named 'find'
ModuleNotFoundError: No module named 'find'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'find' How to remove the ModuleNotFoundError: No module named 'find' error
ModuleNotFoundError: No module named 'find'
ModuleNotFoundError: No module named 'find'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'find' How to remove the ModuleNotFoundError: No module named 'find' error
MySql find and replace string
MySql find and replace string  How to find and replace string or special characters in MySql & PHP?   Find and Replace String PHP $result = preg_replace('/\band\b/i', 'foo', $subject
janusgraph find edge with label
janusgraph find edge with label  Hi, I am working on JanusGraph graph server. I want to find all the edges with a particular label. How to find... for find edge with label: g.V().hasLabel('MyLevel') Thanks
WAP to find HCF
WAP to find HCF  Hi, can any one please share teh code to find the HCF of 2 or 3 numbers
Taking Substring
. The methods used: substring(int i): This method is used to find all sub...): This is used to find the substring between start and end point... Taking  Substring      
Find city latitude and longitude
Find city latitude and longitude  Hi, I have to find find city latitude and longitude for one of map based application. My application is based on Google map and I am adding cities using city latitude and longitude. In my

Ads