[REBOL] Re: need help with comparison operator <> evaluation
From: AJMartin:orcon at: 24-Dec-2003 22:47
> Now, the next step would be to generalize this stuff in case you need
> it again in the future:
>
> change-suffix: func [
> {Changes the suffix of the string and returns the updated string.}
> string [any-string!] "The file, url, string, etc. to change."
> suffix [any-string!] "The new suffix."
> /local s
> ][
> attempt [if #"." <> first suffix [suffix: join %. suffix]]
> append either s: find string suffix? string [clear s][string]
suffix
> ]
You might find this function helpful:
Extension: function [
"Changes the extension of the path to the specified extension."
Path [file! url!]
Ext [file!] "Like: %.txt"
] [Dot] [
all [
Dot: any [find/last Path #"." tail Path]
not find Dot #"/"
clear Dot
append Path Ext
]
]
Andrew J Martin
Speaking in tongues and performing miracles.
ICQ: 26227169
http://www.rebol.it/Valley/
http://valley.orcon.net.nz/
http://Valley.150m.com/