Re: New "cut" operator (was: Pike 8.0 RC1)
Peter Bortas <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <CA+NK+ADcTpweeeLu+CW9Oh9y=AGv4076vQMpBznO4D1_53x8Rw@mail.gmail.com> |
On Sun, Nov 16, 2014 at 12:50 AM, 郭雪松 <[email protected]> wrote: > new operator feature sugest: > > ("cut left example"<<" ")=="left example" > ("cut left example">>"ex")=="cut left " NAK. It's a very specific and unobvious use of an operator that conflict both with both the (unfortunately) adopted C++ iostream syntax and the more obvious mathematical "much greater|lesser than". It looks sort of useful but would do well as a functions to make sure the code is readable. Something like this: string cutback(string text, string divisor) { return (text/divisor)[1..]*divisor; } string cutfront(string text, string divisor) { return (text/divisor)[0]; } With better names if possible. -- Peter Bortas