From: Matthias Ludwig Date: 2006-02-15T08:50:54+09:00 Subject: Re: simple programming q --3V7upXqbjpZ4EhLz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > #example pseudocode idea > blokoftxt =3D 'Theres some text in block.' > replacekey =3D { 'T' =3D 'W', 'a' =3D 'o', 'o' =3D 'a' } you can use String.gsub! to replace a pattern replacekey.each_key {|key, value| blockoftext.gsub!(key, val) } this works for your example, but not for something like {'.' =3D> 't'}=20 because first parameter of gsub is a regexp!! --3V7upXqbjpZ4EhLz Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (FreeBSD) iD8DBQFD8mzQbaBeCFlfXPMRAvoLAJ9QwtWszFZ2MyIuqH5tVae/B7LAvwCgxRIo gGsTPmExMDygz0pxHm9aMho= =1/nQ -----END PGP SIGNATURE----- --3V7upXqbjpZ4EhLz--