Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplay only found results
    primarykey
    data
    text
    <p>A follow up to my Item Scanner, a java tool that scans through a directory of *.txt files.</p> <p>Thank you all for the help! However now I have a different problem.</p> <p>When I get the results it reads strings I do not want it to read. How can I block out these strings I do not want it reading?</p> <p>This is an example what I mean:</p> <pre><code>Enter item to find: 1112 Found 125000000 [BANK] [FRIENDS] [IGNORES] [EOF] time(s) in kyle.txt! Found 1000000 [FRIENDS] [IGNORES] [EOF] time(s) in kylea.txt! Press any key to continue . . . </code></pre> <p>I want it to display the results like this:</p> <pre><code>Enter item to find: 1112 Found 125000000 time(s) in kyle.txt! Found 1000000 time(s) in kylea.txt! Press any key to continue . . . </code></pre> <hr> <p>How would I do this? I tried creating an array list to block the other results I do not need, but I can't get it to work either.</p> <p>Thank you for the help!</p> <p>Also, here is my code:</p> <pre><code>import java.io.*; import java.util.*; public class ItemScanner { public static void main(String args[]) { System.out.print("Enter item to find: "); Scanner sc = new Scanner(System.in); find(sc.nextLine()); } public static void find(String delim) { File dir = new File("accounts"); if (dir.exists()) { String read; try { File files[] = dir.listFiles(); for (int i = 0; i &lt; files.length; i++) { File loaded = files[i]; if (loaded.getName().endsWith(".txt")) { BufferedReader in = new BufferedReader(new FileReader(loaded)); StringBuffer load = new StringBuffer(); while ((read = in.readLine()) != null) { load.append(read + "\n"); } String delimiter[] = new String(load).split(delim); if(delimiter.length &gt; 1) { System.out.println("Found " + (delimiter[1]) + " time(s) in " + loaded.getName() + "!"); } } } } catch (Exception e) { e.printStackTrace(); } } else { System.out.println("error: dir wasn't found!"); } } } </code></pre> <p>Also, an example of an account it scans through, here is an account:</p> <pre><code>[ACCOUNT] character-username = kylea character-password = [CHARACTER] character-height = 0 character-isactive = 1 character-messages = 0 character-lastconnection = character-lastlogin = 2009/11/27 character-energy = 100 [EQUIPMENT] character-equip = 0 4724 0 character-equip = 1 1052 0 character-equip = 2 6585 0 character-equip = 3 4151 0 character-equip = 4 4720 0 character-equip = 5 1215 0 character-equip = 6 -1 0 character-equip = 7 4722 0 character-equip = 8 -1 0 character-equip = 9 775 0 character-equip = 10 1837 0 character-equip = 11 -1 0 character-equip = 12 6735 0 character-equip = 13 -1 0 [LOOK] character-look = 0 1 [SKILLS] character-skill = 0 18 445633 character-skill = 1 15 440000 character-skill = 2 15 440000 character-skill = 3 199 1402300000 character-skill = 4 22 0 character-skill = 5 1 0 character-skill = 6 1 0 character-skill = 7 1 0 character-skill = 8 1 0 character-skill = 9 1 0 character-skill = 10 1 0 character-skill = 11 1 0 character-skill = 12 1 0 character-skill = 13 1 0 character-skill = 14 1 0 character-skill = 15 1 0 character-skill = 16 1 0 character-skill = 17 1 0 character-skill = 18 1 0 character-skill = 19 1 0 character-skill = 20 1 0 character-skill = 21 1 0 character-skill = 22 1 0 character-skill = 23 1 0 character-skill = 24 1 0 [ITEMS] character-item = 0 6570 11 character-item = 1 666570 0525 character-item = 2 1165701 55 character-item = 3 55 66 character-item = 4 963 51 character-item = 5 961 55 [BANK] character-bank = 0 996 1000000 [FRIENDS] [IGNORES] [EOF] </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload