Is there an established convention for separating Windows file names in a string?
- by Heinzi
I have a function which needs to output a string containing a list of file paths. I can choose the separation character but I cannot change the data type (e.g. I cannot return a List<string> or something like that).
Wanting to use some well-established convention, my first intuition was to use the semicolon, similar to what Windows's PATH and Java's CLASSPATH (on Windows) environment variables do:
C:\somedir\somefile.txt;C:\someotherdir\someotherfile.txt
However, I was surprised to notice that ; is a valid character in an NTFS file name.
So, is the established best practice to
just ignore this fact (i.e. "no sane person should use ; in a file name and if they do, it's their own fault") or
is there some other established character for separating Windows paths or files? (The pipe (|) might be a good choice, but I have not seen it used anywhere yet for this purpose.)