Thursday, July 10, 2008

Brain teaser :)

What better way to kick off the new blog than with an answer to Dustin Diaz' Programming Brain Teaser?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" 
    creationComplete="cc()">
    
    <mx:Script>
    <![CDATA[
        
        private function cc():void
        {
            
            trace(['a', 'b', 'c', 'c', 'd','e', 'e', 'e', 'e', 'e', 'f', 'e', 'f', 'e', 'f', 'a', 'a', 'a', 'f', 'f', 'f'].join(" ").replace(/(.) \1((?: \1)+)/g, "$1 $1 <span>$2 </span>"));
            
        }
    
        ]]>
    </mx:Script>
</mx:Application>

1 comments:

Stormi Winscot said...

But can you do it in one line? ...damnit... nevermind.

This is

  • Tales of Flex
  • From Brisbane, Australia
  • Opinions on Flex development
  • Tips and FAQs
  • Shameless self-promotion

I am

  • Twitterer
  • Flexcoder
  • Maroon
  • Designer
  • Java lover
  • That loud-mouthed Aussie yob
  • Blogger
  • Problem solver
  • Contributor
  • Cricket Fan
  • Lousy photographer
  • Great cook

I read



Subscribe via RSS to receive updates!