ok, heres the deal. I made a backup of my simcard phonebook on my old phone, and was able to JUST read it on my pc in notepad, because tbh it's full of crap i don't need. Here's an excerpt:
and all i need out of it is:Code:BEGIN:VCARD VERSION:2.1 N:;Abertay TEL;PREF;HOME;CELL;VOICE:01382308000 CATEGORIES:0 END:VCARD
Abertay
0138230800
-insert blank line here-
so far, I can take the file and write the contents out to my own file, using THIS code:
though amdittedly, it fills it full of worse junk...Code:import java.util.*; import java.io.*; import javax.swing.*; public class SimCleaner{ public static void main(String[]args){ Boolean inputcorrect = false; String inputfilename; String outputfilename; while(inputcorrect==false) { inputfilename=JOptionPane.showInputDialog("Please enter the name of the backup file to open, case sensitive (with extension)"); outputfilename=JOptionPane.showInputDialog("Please enter the desired output filename, case sensitive (with extension)"); try { BufferedReader in = new BufferedReader(new FileReader(inputfilename)); BufferedWriter out = new BufferedWriter(new FileWriter(outputfilename)); String str; while ((str = in.readLine()) != null) { System.out.println(str); out.write(str); out.write("\n"); } in.close(); out.close(); inputcorrect=true; } catch (IOException e) { JOptionPane.showMessageDialog(null, "Error: File not found. Please check that the backup file is in the root directory, and that you spelt the filename correctly"); inputcorrect=false; } } JOptionPane.showMessageDialog(null,"Done"); } }
I'm not sure how to start removing strings from it though. Could anyone give me some help with this? It's not homework or anything, its just a little side project I'm doing on my own, felt like doing it to keep my "skills" "fresh" lol
Thank you in advance
Chris Finlay


Reply With Quote


Bookmarks