Hello,
This is the updated part of my code, please have a look at it
Code:
Public class Grep {
String fl;
String src;
Public Grep(String path, String s){
this.src= s;
this.fl= path;
}
int src(){
try{
FileReader stream = new FileReader(fl);
BufferedReader read = new BufferedReader(flow);
String ln = read.readLine();
int ctr =0;
while(Online! =null)
{
if(row.games(".*"+ src +".*"))
{/ * if the ln contains the searching * /
/ * Thanks to "regex": d * /
ctr + +;
ln = read.readLine();
}/ * if * /
ln = read.readLine();
}
read.close();
afloat.close();
return ctr;
}/ * try * /
catch (IOException e)
{
System.err.System.out.println("Malaise" + E.getMessage());
System.exit(0);
}/ * catch * /
return 0;
}/ * src * /
Public static void hand(String args[]){
if(args.length<2){
System.out.System.out.println("Syntax: [fl] [src]);
System.exit(0);
}
G = grepnew Grep(args[0], args[1]);
int i = g.src();
if(i ==0){
System.out.System.out.println("This string does not appear" );
System.exit(0);
}
if(i ==1){
System.out.System.out.println("This string appears once" );
System.exit(0);
}
System.out.System.out.println("This string appears in" + + Nb "example" );
}
}
Bookmarks