How parse Date and Integer from the same String given in input?

Viewed 36

Let's assume that in input is given something like that:

Date of birth: 01/01/1990, age 32

Scanner input = new Scanner (System.in)
String input = scanner.nextLine();

I have to store some value in this variable:

int day;
int month;
int year;
int age;
LocalDate ld; //I'm not sure if I should use this object or Date

I don't know if is possible to manage with only Scanner object or if i should use string Builder.

I'm looking for the easiest way.

0 Answers
Related