[REBOL] Re: HTML Obfusticate to hide email addresses
From: brian:hawley at: 26-Apr-2003 11:32
At 06:10 PM 4/24/03 +1200, Andrew Martin wrote:
(a useful function named HTML_Obfusticate)
Here's a faster version that doesn't use map.
HTML_Obfuscate: func [
Plain [string! email!] /local out
; No need to convert email to string
out: make string! 6 * length? Plain
foreach x Plain [
x: to-integer x
out: insert out reduce [
"&#" any [
if x < 10 ["00"]
if x < 100 [#"0"]
] x #";"
Not that there's any problem with using map
(that I know of, as I've never used it). I
just know that this version is faster because
it uses mostly natives, creates the destination
string ahead of time, and doesn't recreate an
inner function with every call.
Watch out though: In current REBOL, a function's
local variables will keep their references until
the function is called again (non-recursively);
in this case that means the converted string. If
memory is a concern, these kind of things matter.
Probably not when obfuscating email, though :)
Now, off to check out map !