On Wed, Aug 13, 2003 at 10:59:18AM +0900, Nikolai Weibull wrote:
> yeah, this works.  The problem is - I would prefer tr(), as I could then
> list other characters as well.  It's a bitch having to give a long list
> of gsub()'s.

The problem is that Ruby Strings are still logically treated as 
collections of bytes rather than collections of characters.  So
String#tr only works for characters whose representation takes up a 
single byte - which, in the case of UTF-8, means only the 7-bit
ASCII characters.

To avoid the unightly gsub chaining, you can write your own tr-like
method that takes an array of regexes and a corresponding array
of substitutions:

	class String
	    def trsub!(res, subs)
		res.each_with_index do
		    |re, i|
		     self.gsub!(re, subs[i] || '')
		end
	    end
	end
		
	s.trsub!(%w<™όΓ΅£ ¥½>,  %w<n a e i o u u>)