Advertisement
Guest User

Identify

a guest
May 17th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.ArrayList;
  3. import java.util.Arrays;
  4.  
  5. public class CCOdeIdentify
  6. {
  7.     public static void main (String arg[])
  8.     {
  9.         try
  10.         {
  11.             String dest = "/home/ndub/Desktop/c.txt";
  12.  
  13.             FileReader fileReader = new FileReader(dest);
  14.             BufferedReader bufferedReader = new BufferedReader(fileReader);
  15.  
  16.             String line;
  17.             StringBuffer sb = new StringBuffer();
  18.  
  19.             while ((line = bufferedReader.readLine())!=null)
  20.             {
  21.                 sb.append(line);
  22.                 sb.append(" ");
  23.             }
  24.  
  25.             String lineout = sb.toString();
  26.  
  27.             String[] splet = lineout.split(" ");
  28.  
  29.             ArrayList<String> arr = new ArrayList<>(Arrays.asList(splet));
  30.  
  31.             ArrayList<String> keyWords = new ArrayList<>();
  32.  
  33.             if(arr.contains("#include")&& arr.contains("<stdio.h>"))
  34.             {
  35.                 //regex pattern (# <>) check and print
  36.             }
  37.  
  38.  
  39.         }
  40.  
  41.         catch (IOException e)
  42.         {
  43.  
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement