android - Search for two strings at once in java -


so on basic level there way (maybe using operator) string or 1 within same variable declaration. (maybe array). i've tried operators such pipe , & , doesn't work single string variable input. have tried putting strings array , using string value of array no avail. thank you

elements names= doc.body().getelementscontainingowntext("mr."); (element web2: names) {     log.i("names", web2.text()); } 

i want check "ms." @ same time because sequence matters in instance. way jsoup sdk 1.8.3.

you can use method getelementsmatchingowntext(string regex).

so match mr. or ms. query like,

elements names= doc.body().getelementsmatchingowntext("mr\\.|ms\\."); // escape . in regex. 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -