I have:
String ex = "INSERT INTO `countries` VALUES (1, 'Afghanistan')";
How can I remove everything except what is in ‘ ‘ with java? What is inside quotes is variable.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can take pieces and parts out of the
Stringby using thesubstring,indexOf, andlastIndexOfmethods. You just may have to loop through a few times in case there is more than 1 pair of quotes found within the text. However, if it’s just one, you could use this:These will include the quotation marks. If you do not want the quotation marks, you would do: