bender bender
unread,Mar 8, 2021, 12:11:00 PM3/8/21You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
ciao,
con questo pezzo di codice riesco a estratte da un file .csv le stringhe che contengono un dato termine.
Come posso salvare i dati ottenuti in un nuovo file .csv?
public static void main (String[] args) throws IOException
{
File fileCSV = new File("data.csv");
BufferedReader streamCSV = new BufferedReader(new FileReader(fileCSV));
String lineRead;
String SearchWord="Affori";
while( (lineRead=streamCSV.readLine()) != null )
{
for (int i=0; i<((lineRead.length()-SearchWord.length())+1);i++)
{
String portionLine = lineRead.substring(i, i+SearchWord.length());
if (portionLine.equals (SearchWord))
System.out.println(lineRead);
}
}
streamCSV.close();
System.exit(1);
}
}
Alberto