How to strip specific contents of a String in Java

Posted by user2974877 on Stack Overflow See other posts from Stack Overflow or by user2974877
Published on 2013-11-09T21:48:28Z Indexed on 2013/11/09 21:53 UTC
Read the original article Hit count: 198

Filed under:
|
|

So I have a string, and I want to strip out some parts of it using, for example, the firt and last characters of the "interesting" part.

String dirty = "$!$!%!%$something interesting&!!$!%$something interesting2";

And the output something like:

String clean = "something interesting:something interesting2";

Note: The code needs to work without knowing the random part, changing everytime the program runs. I researched and only found code that does it, but only knowing the random segment.

© Stack Overflow or respective owner

Related posts about java

Related posts about string