Given a string of multiple concatenated filenames, how can i split the given string in a number of substrings such that each substring is a valid file

Viewed 19

I have a string that consists of multiple filenames delimited by the ',' symbol. I want to split this string into substrings where each substring is a valid file path. However, I realized that ',' can be a correct part of a filename, therefore, naive splitting at the ',' symbol does not work.

Is there any method on how I can parse filenames from this given string? The ',' delimiter was an arbitrary choice and can be replaced by any symbol that in the best case, can not be used in a filename on Windows, Linux, and Mac.

0 Answers
Related