A better Suffix? function
[1/4] from: al:bri:xtra at: 6-Aug-2002 23:11
>> source suffix?
suffix?: func [
{Return the extension of a filename or URL, else none.}
Path [file! url!]
][
all [
Path: find/last Path #"."
not find Path #"/"
Path
]
]
It's a couple of words shorter and keeps the original type, either file! or
url!, and allows it's use in filename and path extraction functions.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[2/4] from: anton:lexicon at: 7-Aug-2002 14:33
Looks good to me.
Anton.
[3/4] from: anton:lexicon at: 7-Aug-2002 14:38
Good, although, why didn't you keep Path any-string?
Anton.
[4/4] from: al::bri::xtra::co::nz at: 7-Aug-2002 22:52
> Good, although, why didn't you keep Path any-string?
All the paths I use are file! or url!. I haven't yet come across a case
where a paths is string!. So I believe it's best to have a close fit.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/