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?


_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to