From: Nikolai Weibull Date: 2005-06-02T02:11:31+09:00 Subject: Re: Method Chaining Issues Phrogz wrote: > Some kind soul should search the archives for all the threads and RCRs > surrounding this topic and create a page on the wiki with links, so we > can redirect people to it. > > In short - some people think it's nice that the 'bang' methods return > nil if no change was effected, some people do not. You can either chain > them using intermediary strings: > > string.sub('old','new').reverse > > or you can use the bang methods, but not use chaining > > string.sub!('old','new') > string.reverse! It should also be pointed out that the non-destructive version of sub (i.e., String#sub) method often turns out to be faster than the destructive one (i.e., String#sub!), nikolai -- Nikolai Weibull: now available free of charge at http://bitwi.se/! Born in Chicago, IL USA; currently residing in Gothenburg, Sweden. main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}