aspose file tools
The moose likes Java in General and the fly likes how do you parse an array Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "how do you parse an array" Watch "how do you parse an array" New topic
Author

how do you parse an array

Robert Johnson
Ranch Hand

Joined: Feb 11, 2005
Posts: 32
if i have...
String[] homeTeamScores = request.getParameterValues("homeTeamScore");

can i use...
int[] homeTeamScores = Integer.parseInt(homeTeamScore[]);

???


Whats in a name?
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
Originally posted by Robert Johnson:
if i have...
String[] homeTeamScores = request.getParameterValues("homeTeamScore");

can i use...
int[] homeTeamScores = Integer.parseInt(homeTeamScore[]);


No, homeTeamScore is of type Array, Integer.parseInt takes a String. Also 'homeTeamScore[]' isn't valid syntax. You use empty [] to declare an Array, once you have an Array you can either use the Array itself or access what it holds with [int].

You will have to loop through homeTeamScore.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: how do you parse an array
 
Similar Threads
Cant use object from another class
Posting to bump up my count...
WA #1.....word association
The x900 effect ?
Text box value is not being completely filled with request attribute