From: Jeff 'japhy' Pinyan Date: 2002-02-12T08:51:14+09:00 Subject: Re: [newbie] make first letter lowercase On Feb 11, Tobias Reif said: >sebi wrote: > >> sorry for this very simple question, but how would i turn the first >> letter of a string into lowercase? > >class String > > def upcase_first > out = self.dup > out[0,1] = out[0,1].upcase Ick. Am I the only one that finds that syntax a little disappointing? I would much rather be able to say out[0,1].upcase! or even out[0].upcase! Now, as far as the first one goes, yes, I know out[0,1] creates a COPY of the first character of the string, and I know that out[0] returns a FixNum, but still... there's something that screams "too much work" to me. It's probably because there's no concept of pointers here. I've been thinking of implementing pointer-like things into Perl, but I'm not sure how useful they would be. -- Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** what does y/// stand for? why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ]