[REBOL] Re: My function seems to have no effect
From: g:santilli:tiscalinet:it at: 15-Apr-2002 18:19
Hi COFFRE,
On Monday, April 15, 2002, 11:46:04 AM, you wrote:
CRF> get_func_name: make function! [ chaine ] [
CRF> use [ guillemet ] [
CRF> guillemet: make string! {"}
CRF> remove/part chaine 6
CRF> foo: copy/part chaine 1 1
CRF> if foo == guillemet [ remove/part chaine 1 ]
CRF> ; Supprimer les 2 derniers caractères
CRF> clear skip tail chaine -2
CRF> return (chaine)
CRF> ]
CRF> ]
I see others have answered your question, but I'd like to point
out another way to write your function; I hope it can be useful.
get_func_name: func [chaine /local chars-to-skip start end] [
chars-to-skip: either chaine/7 = #"^"" [7] [6]
start: skip chaine chars-to-skip
end: skip tail chaine -2
copy/part start end
]
which can be reduced to:
get_func_name: func [chaine] [
copy/part skip chaine either chaine/7 = #"^"" [7] [6] skip tail chaine -2
]
which will probably be much faster than your version.
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r