Match File ExtensionsAuthor: Anton Rolls In newer versions of REBOL you can get the suffix of a file with the SUFFIX? function:
But, earlier versions of REBOL such as View 1.2.1 and Core 2.5.0 did not have the SUFFIX? function. So, here is a method that works in all versions:
Note here that the file must be of the file datatype. Example usage:
I arrived at this method after some experimentation. At first glance it doesn't look like the most optimal approach, but it works robustly. You can make a function, if needed:
Note that the FORM function was added to allow this function to work for strings as well as files:
|