From: Dave Thomas Date: 2002-02-13T03:27:58+09:00 Subject: Re: [newbie] make first letter lowercase Tobias Reif writes: > > str.upcase!(2,4) > > str.tr!('a', 'b', 5, 6) > > is easier, simpler, and shorter to write than this > > > str.expose!(1,2).upcase > > str.expose!(5,6).tr('a', 'b') I guess we'll have to disagree on all but the 'shorter' part, and in programming, as in so many things, shorter isn't _always_ better. In addition, how would you write methods such as String#squeeze! using the first notation? How would you differentiate a String being used to define an index range from a string being squeezed (remembering that str["a"] is a valid way to index a string)? And how would you pass an exposed fragment of a string to another method for processing? def mangle(str) str.tr!("a-m", "b-n") end mangle(str.expose!(3,5)) (In looking at my original examples, I suspect that update and tr should have '!'s on them) Cheers Dave