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
Post a Comment