Change csv delimiter with java -


the code works fine when use at_separator=",". reason, want change at_separator="@@@" instead of ",". when add data csv file, inserts data new cell when finds "@@@". don't know how change format of csv file default delimiter changes "," "@@@". change or add change csv default delimiter? method in different class writing csvfile. here, at_separator="@@@";

csvfilewriter csvfilemethod = new csvfilewriter(); csvfilemethod.createcsv(filename); while(rs.next()) {       csvfilemethod.saveit(starttime,             rs.getstring("owner") + at_separator +              rs.getstring("name") + at_separator +             rs.getstring("type") + at_separator +             rs.getint("line") + at_separator +             rs.getstring("text") + at_separator +             parentsystem_id + at_separator+             parentplatform);  }  csvfilemethod.closecsv(); 

and csv writer class.

public class csvfilewriter {      public final string new_line_separator;     public final string at_separator;     public string owner;     public string table_name;     public string systemid;     public string platform;      filewriter filewriter;      public csvfilewriter(){         new_line_separator = "\n";         filewriter = null;         at_separator="@@@";      }      public void createcsv(string filename){         try {             filewriter = new filewriter(filename);         } catch (ioexception e) {             e.printstacktrace();         }     }      public void saveit(string starttime, string data){         try {             filewriter.append(data);             filewriter.append(at_separator);             filewriter.append(starttime);              filewriter.append(new_line_separator);                   } catch (exception e) {             system.out.println("error in csvfilewriter !!!");             e.printstacktrace();         }     }      public void saveit(string starttime, string data, int numberofrows){         try {             filewriter.append(data);             filewriter.append(at_separator);             filewriter.append(starttime);              filewriter.append(at_separator);             filewriter.append(numberofrows+"");             filewriter.append(new_line_separator);                   } catch (exception e) {             system.out.println("error in csvfilewriter !!!");             e.printstacktrace();         }     }      public void closecsv(){         try {             filewriter.flush();             filewriter.close();         } catch (ioexception e) {             system.out.println("error while flushing/closing filewriter !!!");             e.printstacktrace();         }     } } 


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -