0
How to split a text line into numbers and the text?
How to split a text line into numbers and the text example: asdfsg214356asfgxczv321d4 =>> [asdfsg, 214356, asfgxczv, 321, d, 4]
3 Answers
+ 8
The obvious solution for pattern matching would be using Regex, just split it by a string of digits while keeping it would do the job.
Here's how we do it in C# and I believe it would be similar in Java too. š
Regex.Split(str, @"(\d+)");
+ 1
Thanks for answers, i made this code:
split("(?<=[\\d])(?=[\\D])|(?<=[\\D])(?=[\\d])");