I need a little help.
I have a matrix which has 25 rows and 4 columns (it's defined "MiaSquadra").
What I wanna do is to transfer the datas from this matrix to an empty exisiting file called "juventus.txt".
But the writing must be personalized, in fact I would like to write 25 rows (corresponding to the rows of the matrix) and each rows should be composed by the datas from the 4 columns with a symbol "%" as delimitator.
MiaSquadra = Christian Buffon
MiaSquadra = P
MiaSquadra = Juventus
MiaSquadra = 23
so I should open the file "juventus.txt" (which is empty) and write the first row that must appears like follow:
and so on for the remaining rows till 25.
I tried in different ways to do this but I failed :(
I am new in Java and maybe I wrong just some small thing :rolleyes:
Can someone suggest me the code?
Thanks in advanced!!!!
09-26-2002, 11:26 AM
read documentation for StringTokenizer class - it has an array of methods and variables for convenient string manipulations as you have asked. Here is one sample code:
String s="Christian Buffon%P%Juventus%23");
StringTokenizer st=new StringTokenizer(s,"%");
String str=new String[num];
09-26-2002, 03:27 PM
:) I have read the documentation about StringTokenizer and all its costructors to split lines in tokens... but I didn't solve my problem.
Maybe I didn't understand your suggestion :( but I couldn't apply StringTokenizer class to my problem because I have a matrix and I want to write on a file, that means I have to do an output stream.
The documentation about StringTokenizer class was relating examples of an input stream when you read from file and want to split lines in tokens....
Sorry for my lack of knowledge, probably I didn't catch your advice... can you explain me what I have to do exactly? :confused: