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

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -