-2

I have a text file in which I have stored a list of aliments ,quantity, and calories separated by "==" from the quantity and by "===" from the calories , this is an example:

File aliments.txt

Funghi Trifolati_ING == 200 G === 50
Funghi Trifolati_ING == 50 G === 12
Funghi Tritati_ING == 0 === 25
Funghi Tritati_ING == 100 G === 25
Funghi_ING == 0 === 25
Funghi_ING == 1 Cucchiaio === 10
Funghi_ING == 1 Manciata === 10

How I can put aliments, quantity, and calories in three different column of a table?

Rivas202
  • 215
  • 2
  • 8

1 Answers1

0

What kind of table ?

You should you split to split your String in substrings.

String[] alimentAndRest = unsplitString.split("==");
String aliment = alimentAndRest[0];
String[] quantityAndCalories = alimentAndRest[1].split("===");
String quantity = quantityAndCalories[0];
String calories = quantityAndCalories[1];
Gordak
  • 2,060
  • 22
  • 32