Results 1 to 5 of 5
- 11-03-2009, 10:38 AM #1
Member
- Join Date
- Oct 2009
- Posts
- 36
- Rep Power
- 0
change string to array of integer
Hi
in my code I read user input as string then I want to change it to array of integer ...HOW???
for example:
BufferedReader in=new BufferedReader( new InputStreamReader(System.in));
string input=in.readLine();
and here input =45678
now, how can I save these numbers in array of integer??:rolleyes:
- 11-03-2009, 10:54 AM #2
Split the input into a String array, create an int array of the same length and use Integer.parseInt to fill the int array.
Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 11-03-2009, 11:04 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Loop through the string by selecting each character and do conversion. Before that initialize and array on int in the same size of string.
- 11-08-2009, 08:07 PM #4
Member
- Join Date
- Oct 2009
- Posts
- 36
- Rep Power
- 0
Thank u it works
- 11-09-2009, 02:47 AM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
You are welcome. :)
If you've solve the problem, please mark the thread solved from the tools menu. Good luck!
Similar Threads
-
String to Integer Conversion in JSP
By vinikz in forum New To JavaReplies: 8Last Post: 11-10-2010, 02:45 PM -
check if String is an integer?
By McChill in forum New To JavaReplies: 5Last Post: 05-02-2009, 07:51 PM -
How to add an integer to a array element and the store that backinto an array.
By Hannguoi in forum New To JavaReplies: 1Last Post: 03-31-2009, 06:40 AM -
Integer to String
By zervine in forum Forum LobbyReplies: 3Last Post: 09-12-2008, 12:07 PM -
String to Integer conversion
By eva in forum New To JavaReplies: 2Last Post: 12-17-2007, 03:59 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks