From: Mathieu Bouchard Date: 2002-02-12T23:33:53+09:00 Subject: Re: [newbie] make first letter lowercase On Tue, 12 Feb 2002, Tobias Reif wrote: > > x="machin truc patate" > > x.part(7,4).upcase! > > p x #==> "machin TRUC patate" > I like that. > Would that be worth an RCR? Well, it depends whether what you want is #part or that particular combination of #part and #upcase. Here's a more complete example for String#part: x="machin truc patate" x.part(7,4).upcase! p x #==> "machin TRUC patate" y=x.part(4,5) p y #==> "in TR" y.downcase! p y #==> "in tr" p x #==> "machin trUC patate" y.tr! 'a-z','n-za-m' p x #==> "machva geUC patate" y[2]="\n" p x #==> "machva\ngeUC patate" p y.map {|line| "[#{line.chomp}]" }.join #==> "[va][ge]" And it actually works here (after 3 more lines of patching the actual source). ________________________________________________________________ Mathieu Bouchard http://hostname.2y.net/~matju