Little bird Little bird - 2 months ago 13
Java Question

How to get a whole string value from a substring pattern

I need to get a string from a sub-string.

String whlval = "I have stackoverflow accounts and i use to login from different users
i.e Angel23552 wow isn't it";


So i want to retrieve the whole value "Angel23552" i.e result as "Angel23552" from Angel

Conditions :-


  1. I can only use Angel string to retrieve value from the String whlval as

    23552 is random value.

  2. Above string i.e whlval has different spaces gaps between two 2 strings.


Answer

Hmm, maybe:

String[] split = StringUtils.split("I have   stackoverflow    accounts and i use to login from different   users  i.e Angel23552 wow isn't    it");

StringUtils.split() method

Then in loop you may try to use StringUtils.contains(CharSequence seq, CharSequence searchSeq) - returns true or false

StringUtils.contains() method

Comments