Skip to content
Advertisement

Substring a string in JAVA

Is possible to substring this String = "D:/test/for test/change.txt:D:/test/for test/further.txt:D:/test/for test/yandex.txt" to:

JavaScript

Because are two column, I can not split() use ":".

Advertisement

Answer

A simple regular expression below splits on “:” that are followed by a “driveletter:”

JavaScript

Note that this won’t help if additional paths don’t begin with driveletter:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement