Hi, I'm looking for help on a program where the user enters a string of text (can be anything), and the program has to pull all the integers out of that string and put them in an array to be printed. I need to use a method to do this. So, for example, if the user inputted: sfd0jd-2jf93jf0, the array would need to contain 0,2,93,0. Here's what I have so far, but I'm now stuck and don't know what I'm doing wrong. Any advice would be great!
Joined: Aug 05, 2008
You could use a Scanner class with a delimiter with a pattern (a regular expression) to match non digits. I wrote a test program and got a print with about 4 lines with this approach.. hope this helps..