Jeremy Hunts
Jeremy Hunts

Reputation: 363

Parsing a date from a string of text

I want to extract the date from the following sentence in java.

"D759,301 Elhalwani June 14, 2016 Hookah Claims CLAIM The ornamental design for a hookah, as shown and described"

Given that there are other sentences with the same structure but different dates, that I also want to extract the date from them.

Upvotes: 0

Views: 55

Answers (1)

Mrtnchps
Mrtnchps

Reputation: 185

1- record input in a String

2- split(" ") String in an array --> without the space

Now if the date is always at spot #2,3 and 4 in the array, it's easy to just look for them. But If they are not always at the same place, then you should create an array "month", "date" and "year" and compare each index of the original array. If they are the same --> record date, else continue.

Upvotes: 1

Related Questions