aspose file tools*
The moose likes Beginning Java and the fly likes converting String[][] to int[][] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "converting String[][] to int[][]" Watch "converting String[][] to int[][]" New topic
Author

converting String[][] to int[][]

Bill Brasskey
Ranch Hand

Joined: Jun 01, 2004
Posts: 47
Although I know this should be the simplest thing in the world, I'm having trouble converting a 2-dimensional String array to a 2-dimensional int primitive array.
int[][] intResult=Integer.parseInt(strResult[1][0]);
where should the brackets go on the right side of the expression...
i guess i'm just missing something here.
[ June 08, 2004: Message edited by: Bill Brasskey ]
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1873
HI Bill,

parseInt() can deal with only ONE string and spits out ONLY ONE int. So you would have to run a for loop to convert all objects in String[][] to int[][]...it can't be done by single API call.

Thanks
Maulin
Bill Brasskey
Ranch Hand

Joined: Jun 01, 2004
Posts: 47
is there any other way to do this w/out the for loop?
implicit conversion?
Lavern Matthew
Ranch Hand

Joined: Jun 05, 2004
Posts: 38
No. You need too:


Matthew Wilson<br />-http://valuelist.sourceforge.net
Wayne L Johnson
Ranch Hand

Joined: Sep 03, 2003
Posts: 399
I'm afraid not: you're stuck with doing a nested "for" loop.

Why are you so concerned with this? A nested "for" loop only adds a few extra lines to your code.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: converting String[][] to int[][]