[Newbies] pretty printing

Claus Kick claus_kick at web.de
Mon Sep 29 17:07:35 UTC 2008


Bert Freudenberg wrote:

  > Guess I have to provide an alternative:
> 
> #('&' '&amp;' '<' '&lt;' '>' '&gt;' '''' '&apos;' '"' '&quot;')
>     pairsDo: [:c :s| string := string copyReplaceAll: c with: s].

> (this is the same approach as in String>>asHTML)

Ok, to nitpick (;)) one message send less for each pair:

#('&' '&amp;' '<' '&lt;' '>' '&gt;' '''' '&apos;' '"' '&quot;')
  pairsDo: [:c :s| string := string copyReplaceAll: c with: s 
asTokens:false].

How do pairs compare to dictionaries in Squeak?




More information about the Beginners mailing list