In dealing with the wonderful world of filenames allowed by Apple, I’m faced again with an issue. I had changed the way that two of my apps deal with CSV files to use the pipe symbol “|” instead of the comma since customer use commas (and • and & and * and … you get the picture) in file names. This has worked for many years - until this weekend when I’ve learned that on audio app (Pro Tools) allows the use of the “|” symbol in file names.
Here’s my question - I receive a line of text from the specified file that looks like this:
VL:x|5031936|0|5320013|0|./My Documentary Deliverables/Ringworld Architects | World Series/Viva Hate/12 Dial-A-Cliché.mp3
Note that the path has the “|” embedded in one of the folder names (you may need to scroll horizontally). Therefore, when I SplitB that, I end up with 7 fields instead of the expected 6. The only workaround I’ve come up with is to get the UBound of the SplitB array, and if it’s more than 6 (index 5), I add the | back in and then append the next array value.
This works, but since users are so creative, my quandary is how many If entries do I account for beyond pathPart(5)?
It’s my hope that there’s a blue pill out there that will let me handle this without needing to potentially account for 10+ “|” symbols in the path .
My advice is to properly escape any special delimiter characters in the csv file. Otherwise, you’ll spend the rest of your life fixing your code whenever someone finds a novel new way to name files. Code for properly reading and writing csv files (with proper escaping) has been posted here in the past.
You should really enclose strings in quotes as “string”, and if needing embedding a quotation mark, double it as in Xojo as “this is ““quoted”””, so you can have strings as “my file * ! jshf, ||| whatever .txt”