Posted: Fri Apr 30, 2004 7:38 pm Post subject: Filenames and the Index Function
Ok, i want to separate the filename fromt he file path which is entered by the user. How would i do this? like...
i want to find the last / or \ in the path and then save all letters after that as the filename. Im not very good with the index function. could someone help?
Posted: Sat May 01, 2004 7:19 am Post subject: (No subject)
Index is good for the first occurence. if you want the last, I'd use a decreasing for loop.
for decreasing i : length (path) .. 1
if path (i) = "/" then
filename := path (i + 1 .. *)
You could also check for "\\" in the path if that's what you chose to use, but come on, just stick with the single slash in your pathnames.