Todd Benson
7/23/2008 2:32:00 AM
On Tue, Jul 22, 2008 at 9:10 PM, Cheyne Li <happy.go.lucky.clr@gmail.com> wrote:
> Hi, there
>
> For example, how can i get "HelLoha" from "helloha"
Here's one for fun...
SEPARATION, s = 32, 'helloha'
(my_letters = [0, 3]).each {|b| s[b] -= SEPARATION}
puts s
...it's goofy, because I'm golfing and also trying to be descriptive
at the same time :-)
Of course, I'm making a large assumption that the letters to be
capitalized are based on position.
Here's a contrived one...
include 'matrix'
(Vector[*'helloha'.unpack('C*')] - Vector[1,0,0,1,0,0,0] * 32).to_a.pack('C*')
...umm, ugly.
Todd