From: Bertram Scharpf Date: 2007-08-15T19:11:21+09:00 Subject: Re: Random case chars? Hi, Am Mittwoch, 15. Aug 2007, 18:36:32 +0900 schrieb Haze Noc: > Does anyone have any good ways of transferring a string to random chars? > For example, our string is hello, and i want HeLlO or something.. Is > there an easy way of doing this without splitting the string and reading > each value of an array? "--hello--".gsub /[a-z]/i do |x| rand(2)>0 ? x.downcase : x.upcase end class String def rand_case! gsub! /[a-z]/i do |x| rand(2)>0 ? x.downcase : x.upcase end end end I don't know how to treat umlauts or UTF-8. Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de