Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- public class JavaApplication1 {
- public int parsowanie(String plik, String fraza){
- int licznik=0;
- try{
- char c; int i;
- FileReader fr= new FileReader(plik+".txt");
- FileWriter fw= new FileWriter("kopia_"+plik+".txt");
- do{
- i=fr.read();
- if(i !=-1){
- c = (char) i;
- if (c<=9) c--;
- else if(c==0)c=1;
- fw.write(c);
- }
- }while(i != -1);
- fr.close();
- fw.close();
- }catch(Exception e){
- e.printStackTrace();}
- try{
- BufferedReader br = new BufferedReader (new FileReader(plik+".txt"));
- BufferedWriter bw = new BufferedWriter(new FileWriter("kopia_"+plik+".txt"));
- String s; String tab[]=new String[100];
- int l=0;
- while (s != null)
- { s = br.readLine();
- for(int a=0;a<=s.length();a++){
- tab=s[a].split(" ");
- if (tab[a].equals (fraza))
- tab[a].toLowerCase();
- if (tab[a].equals (fraza))
- tab[a].toUpperCase();
- l=s.length();
- bw.write(s);
- }
- if (licznik<l)licznik=l;
- br.close();
- bw.close();
- }
- }catch(Exception e){
- e.printStackTrace();}
- return licznik;
- }
- public static void main(String[] args) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement