Advertisement
Guest User

Untitled

a guest
Feb 7th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 0.86 KB | None | 0 0
  1. run('C:\\Users\\Paweł\\Desktop\\data2.txt')
  2.  
  3.  
  4. def run(file) {
  5.  
  6.     def start = System.currentTimeMillis();
  7.     println(start);
  8.      File f = new File(file)
  9.  
  10.  
  11.     f.split { el ->
  12.          String[] arr = new String[3];
  13.         arr = splitString(el);
  14.        
  15.         def length = arr[0].length();
  16.        
  17.         for(int i = length - 1; i >= 0; i--){
  18.             if( String.valueOf(arr[0].charAt(i))  +   String.valueOf(arr[1].charAt(i)) !=  String.valueOf(arr[2].charAt(i))){
  19.             println 'break'
  20.                 break;
  21.             }
  22.         }
  23.     }
  24.  
  25.     def end = System.currentTimeMillis();
  26.     println(end);
  27. //    print('Przetwarzanie wierszy trwało ' + (end - start)/1000 + 'ms, przetworzono wierszy ' + linesCounter + ', w tym sum prawidłowych ' + trueCounter);
  28. }
  29.  
  30. def splitString(String str) {
  31.     return str.split(";");
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement