Printing correctly an array of string...

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
 
G

Gabstar

Not sure what the problem is here. All your tokens in the
StringTokenizer are already Strings, so you don't need to convert them
back to doubles to print them, just call 'println' for all of them.

Get back if I've missed the point...
 
G

gbattine

Excuse me but yesterday i was been a bit confused,
i try to be more clear....

Now i have an array of string and i want print them into a jsp result
page.
How can i do?
I use jsf, i ve created a bean with

private String[] arraylinee;

and i've created the setter and getter method.

Now i have to print this array,i think,with datatable.........can you
help me with code....thanks...

P.S. There is a possibility to do in a second moment a query on this
array of strings?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,128
Latest member
ElwoodPhil
Top