I am using WEBUTIL to upload files to the database in webforms. I also wanted to store the filename in the database but without the path. This meant having to find the last ‘\’ (windows) in the string that the WEBUTIL upload procedure returns and taking the rest as a substring.
My first idea was to create a loop using instr() to find all the ‘\’ instances and exiting the loop when all of them were found. Then someone on IRC pointed out to me that INSTR has a third argument which also takes negative values, and I could use it like this:
instr(p_file_name_with_path, ‘\’, -1);
That gave me the last ‘\’ of the string.