Hi i have a small problem and think i\'m just not getting the correct syntax on one line of code. basically, i can write into my csv file and find a specific record using st
ok i am doing something like this. i can access the csv record pointed to by tokens but it does not update i think incorrect syntax
private static void ChangeRecord(String sFileName) {
// TODO Auto-generated method stub
try {
BufferedReader r = new BufferedReader(
new InputStreamReader(
new FileInputStream(sFileName)));
String line;
while((line = r.readLine()) != null){
String tokens[] = line.split(",");
String Surname = tokens[1];
String network= tokens[2];
String city= tokens[4];
StringTokenizer StrTok = new StringTokenizer(party);
if(StrTok.hasMoreTokens()){
if ((city.equals("New York"))&&(Surname.equals("Smith"))){
String Lovely= "waterloo";
//this line is the one that i think is failing
line.replace(network, Lovely);
System.out.println(line);
}
}
}
r.close();
} catch(IOException e) {
System.out.println(" There was an Error Reading the file. " + e.getMessage());
}