Is there a way to split strings with String.split() and include the delimiters?

Viewed 31371

I'm trying to split a string with all non-alphanumeric characters as delimiters yet Java's String.split() method discards the delimiter characters from the resulting array. Is there a way to split a string like the "\W" regex pattern does, yet keep the delimiters?

0 Answers
Related