For example, if I wanted to find the numbers in ';There are 47 cats at the house';, I would come out with 47...How do you do that?How do you find numbers in a string in java?
Using regular expressions. Been a while time since i used Java but something like.
Pattern pat = Pattern.compile(';\d+';);
Matcher match = pat.Matcher(';There are 47 cats at the house';);
int cats = match.group();
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment