Even better!  great!

    robert

"Martin DeMello" <martindemello / yahoo.com> schrieb im Newsbeitrag
news:f0dKa.278806$ro6.7228707 / news2.calgary.shaw.ca...
> Robert Klemme <bob.news / gmx.net> wrote:
> > Better scaling for large arrays:
> >
> > string.gsub( /\b(\w+)\b/ ) {|m| array.include?( m ) ? "*" * m.length :
m }
> >
> > One can optimize performance by changing the array into a hash and
testing
> > for hash.has_key? instead of array.include?
>
> Or something like
>
> hash = {}
> array.each {|e| h[e] = '*' * e.length}
> string.split(/\b/).map {|w| hash[w] || w}.join()
>
> martin