Extracting integers from string of text in Java -


this question has answer here:

i have several lines of text such as:

"you current have 194764bleh notifications" "you current have 32545444bleh notifications" "you current have 8132bleh notifications" "you current have 93bleh notifications" 

what's best way integers text ?

currently using line.split twice, once "have" , once "bleh".
seems inefficient doing integers.

are there better ways that?

e.g.

string str = "you current have 194764bleh notifications"; str = str.replaceall("\\d", ""); // replace non-digits 

using regex take away non-digits option,
not restrict having 'have' & 'bleh' wrap numbers.

not entirely sure efficiency compared using split though.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -