java - Finding Substring from a String -



java - Finding Substring from a String -

i have next string :

test: testid #123123 - updated

i want find substring 123123 string.

i tried : <msg>.substring(15, 21); gives me right result.

but want find substring in way should find id between # , next space without giving origin , ending index.

thanks.

try this:

s.substring(s.indexof("#")+1, s.indexof(" ", s.indexof("#")+1))

this gives string starting char after # until next blank.

java string substring

Comments

Popular posts from this blog

php - How to pass multiple values from url -

php - Laravel not returning controller -

c# - Confused on how to specify a Platform and Version while using ChromeOptions for RemoteWebDriver with Selenium donNet since recent updates -