RobG wrote on 22 mei 2008 in comp.lang.javas cript:
On May 22, 11:09 am, CTG <BadMul...@gmai l.comwrote:
>var x = "B113769A"
// Return if has invalid characters
if (/[^a-f0-9]/.test(x.toLower Case())) return;
if ( /[^a-f0-9]/i.test(x) ) return;
// Might need left padding
x = (x.length % 2)? '0'+x : x;
>
// Split into an array of pairs, reverse and join again
return x.match(/../g).reverse().jo in('');
Nice! Will remember that one.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Comment