Thursday, 5 September 2013

How do I get what's inbetween " " in a user inputted String? Java

How do I get what's inbetween " " in a user inputted String? Java

I'd like to retrieve whatever is in quotes that someone enters as a
string, i'm assuming it's substring that I need but i'm not sure how.
When the user inputs a string mixed with words and numbers all separated
by one space: hey 110 say "I am not very good at Java"
Then I want to be able to take the "I am not very good at Java" and print
out what's inside the quotes but there can be multiple quotes in the
string. right now I have if( userInput=='"') then I do something with
substring but i'm not sure what.
I can't use trim, tokenizer, regex or anything that would make this really
easy unfortunatley.
Thanks!

No comments:

Post a Comment