+ 1

How can I extract a word and integers from a given String in Java.

Suppose I have a String : " There are 745 apples in John's Basket". I need to extract 745 and word(John). How to proceed? I am a beginner in Java.

14th Nov 2018, 11:50 AM
Shishir Chakraborty
Shishir Chakraborty - avatar
2 ответов
+ 1
i. You can use regex to extract matched pattern from string. Iterate string then check for matched pattern using regex.
14th Nov 2018, 12:43 PM
Suresh B
Suresh B - avatar