Question
java find and replace code pls help me We write code that can find and replace in a given text file. The code you write
java find and replace code pls help me We write code that can find and replace in a given text file. The code you write should take the parameters as command line arguments:
java FindReplace -i -f "
*question mark(?) can be used instead of any character.
"?al" string an be sal ,kal,val
*In addition, a certain set of characters can be given in brackets.(
"kng[a,b,f,d,s]ne" string an be kngane,hngbne,kangfne,kangdne,kangsne
So, all you have to do is match all strings that matchin the input file and output (output the entire contents of the input file) output file. The input file needs to remain unchanged. Input and output files will be a text file. Both strings will be separated by a double quotation mark (") character. To change these special characters in Java you will need to enter an escape character (backslash) like
examples=
java FindReplace -i input.txt -f "sam?jack[3,4,5]" -r "samjack49" -o output.txt
java FindReplace -i doc -f "sam-jack fou?rth nine fifth" -r "sam jack 49 50 " -o doc2
java FindReplace -i input -o output -r "-f" -f "-r"
[replace input -r with -f and write result to output file]
java FindReplace -o out -i inp -f "\[\]" -r "{}"
[replace input [] with {} and write result to output file]
java FindReplace -i input.txt -o output.txt -f "\[?\]" -r "[a]"
[bracketed strings with single characters in it. Replace with [a]]
java FindReplace -i input -o output -f "\?" -r "question mark"
java FindReplace -o out -i input -f "\"" -r " ' "
java FindReplace -i inp -f "sam" -r "jack"
***PLS regex mechanism will not be used.
!!!!!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started