I'm writing a duplicate remover for BibTex. The books are listed in that form:
@Book{abramowitz+stegun,
author = "Milton Abramowitz and Irene A. Stegun",
title = "Handbook of Mathematical Functions with
Formulas, Graphs, and Mathematical Tables",
publisher = "Dover",
year = 1964,
address = "New York",
edition = "ninth Dover printing, tenth GPO printing"
}^
What I have done is to read the data from external txt file, and Tokenize them after each book.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gotowy;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.StringTokenizer;
/**
*
* @author Adam
*/
public class DuplicateFinder {
void deleteDuplicates(File filename) throws IOException{
BufferedReader reader = new BufferedReader(new FileReader(filename));
String textLine = reader.readLine();
String dodaj = "";
do {
//System.out.println(textLine);
textLine = reader.readLine();
dodaj = dodaj + textLine;
} while(textLine != null);
reader.close();
String books;
books = dodaj;
System.out.println(books);
String delimiter = "^";
StringTokenizer st = new StringTokenizer(books,delimiter);
int liczbaTokenow = st.countTokens();
System.out.println(liczbaTokenow);
System.out.println(st);
books.substring(books.indexOf("title") + 3 , books.length());
// while (st.hasMoreTokens()) {
// System.out.println(st.nextToken()+"xDDDDDDDDDDDD");
//}
}
}
And now I need help with get the substring of the title after every "title" keyword (in each token!!) in my list and compare them. Any ideas? Thx in advance! :)