Hi, I have a problem and forgive me if this sounds like a stupid question but I'm not really a good programmer. Ok, this is my problem. Say you have a string and you would like to pull out integers from the string what do you do?
Example:
String question = "I have 20 different textbooks in my bag but you have 4" or
String order = "Time take :11, jumps: 12,3,456,43,23,56"
How do you input the jumps into a 2d array. PLEASE HELP
yazz110
0
Newbie Poster
Recommended Answers
Jump to Postwould depend.
do you know beforehand how the string object will look like? and with this, I mean: do you know before running the application at which position there will be (an) integer(s)?
otherwise, it might be quite tricky, you'll have to check char by char whether it's a digit, …
Jump to Postehm... yes, you can use charAt() (there are other ways too, but ...)
String original = "yep this 123 is a number 456 so was that"; String number = ""; String numbers = "0123456789"; for ( int i = 0; i < original.length(); i++ ){ if ( …
All 6 Replies
stultuske
1,116
Posting Maven
Featured Poster
yazz110
0
Newbie Poster
stultuske
1,116
Posting Maven
Featured Poster
yazz110
0
Newbie Poster
yazz110
0
Newbie Poster
stultuske
1,116
Posting Maven
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.