Let’s say I have a string “-1 2”
Is there a “reverse string.format” where I can grab those ints like
Integer first = new Integer();
Integer second = new Integer();
String.grab("%d %d", first, second);
print(first + " " second); // prints "-1 2"
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 could split your input by spaces, then call Integer.parseInt on each string:
NOTE: this does ZERO error checking