Thursday 15 January 2015

java - finding the first instance of an integer in command line -



java - finding the first instance of an integer in command line -

how find first int of command prompt input user inputs

jdshusaduidsuiuhd3j

what utilize extract 3? thinking

int whatever = new scanner(system.in).usedelimiter("\\d+").nextint();

but doesn't seem work do?

try this:

scanner in = new scanner(system.in); string str = in.next(); int whatever = new scanner(str).usedelimiter("\\d+").nextint();

java

No comments:

Post a Comment