G
gbattine
Hi guys,
i'm a simple question and i need a good solution.
I have an array of byte which contents i have to print in my
application.
I read the array of byte into a string and knowning my original
format(; indicates the end of lines of my original txt file) i have
splitted this string into an array of string with split.
String lettura=new String(read);
String[] arraylinee=lettura.split(";");
Now there is my problem. I have to print correctly this array of
String.
Let's suppose it's made so:
string string string string(a whitespace separes 2 different values)
string double double double
string double double double
Now i have with split operation an array of 3 string elements but i
want to print correctly string and double.
I've done
System.out.println(arraylinee[0]);
for printing my first line that has only strings.
Now i have to develop some code that print correctly the 2th and 3th
lines that has a first string and other doubles. How can i do?
I've done
for (int i = 1; i < arraylinee.length; i++) {
String tot="";
StringTokenizer sta=new StringTokenizer(arraylinee);
System.out.println(sta.nextToken());
/*i have skipped the first line that is already printed and i've
printed the first element of the other generic line,that is a
string*/ while (sta.hasMoreTokens()){
Double.parseDouble(sta.nextToken());
...//what can i do for printing correctly the generic line?
}
}
Can you help me completing my code?
Please....i need your help
i'm a simple question and i need a good solution.
I have an array of byte which contents i have to print in my
application.
I read the array of byte into a string and knowning my original
format(; indicates the end of lines of my original txt file) i have
splitted this string into an array of string with split.
String lettura=new String(read);
String[] arraylinee=lettura.split(";");
Now there is my problem. I have to print correctly this array of
String.
Let's suppose it's made so:
string string string string(a whitespace separes 2 different values)
string double double double
string double double double
Now i have with split operation an array of 3 string elements but i
want to print correctly string and double.
I've done
System.out.println(arraylinee[0]);
for printing my first line that has only strings.
Now i have to develop some code that print correctly the 2th and 3th
lines that has a first string and other doubles. How can i do?
I've done
for (int i = 1; i < arraylinee.length; i++) {
String tot="";
StringTokenizer sta=new StringTokenizer(arraylinee);
System.out.println(sta.nextToken());
/*i have skipped the first line that is already printed and i've
printed the first element of the other generic line,that is a
string*/ while (sta.hasMoreTokens()){
Double.parseDouble(sta.nextToken());
...//what can i do for printing correctly the generic line?
}
}
Can you help me completing my code?
Please....i need your help