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]

5th Mar 2018, 5:08 AM
Š”Š°Š½ŠøŠ»
Š”Š°Š½ŠøŠ» - avatar
3 Answers
5th Mar 2018, 6:50 AM
ŠœŠ³. ŠšŠ½Š°ŠæšŸŒ 
ŠœŠ³. ŠšŠ½Š°ŠæšŸŒ  - avatar
+ 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+)");
5th Mar 2018, 5:40 AM
Zephyr Koo
Zephyr Koo - avatar
+ 1
Thanks for answers, i made this code: split("(?<=[\\d])(?=[\\D])|(?<=[\\D])(?=[\\d])");
5th Mar 2018, 7:03 AM
Š”Š°Š½ŠøŠ»
Š”Š°Š½ŠøŠ» - avatar