RE: New "cut" operator (was: Pike 8.0 RC1)
郭雪松 <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <[email protected]> |
> "cut left example" << " " == " left example"
That is useless.
what I really need is the feature of "between", just like this:
"<some thing>"<<"<">>">" == "some thing"
"<title>TITLE</title>"<<"<">>">"=="titile"
"<title>TITLE</title>"[sizeof("title")+2..]=="TITLE</title>"
"TITLE</title>">>"<"=="TITLE"
"TITLE</title>"[sizeof("TITLE")..]=="</title>"
Guo Xue Song
> Date: Sun, 16 Nov 2014 16:35:47 +0100
> From: [email protected]
> To: [email protected]
> CC: [email protected]; [email protected]
> Subject: Re: New "cut" operator (was: Pike 8.0 RC1)
>
> Excerpts from Peter Bortas's message of 2014-11-16 14:40:39 +0100:
> > > ("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".
>
> well, it's kind of left-shift and right-shift for bits.
> still somewhat unobvious, because obvious would be a number of positions to
> shift which is not much different from array indexing:
>
> "cut left example" << 4 == "left example" == "cut left example"[4..]
>
> if string|array << int is defined as shift by that number of characters then
> string << string could be defined as shift to the first occurrence of that string.
> but with that definition i'd expect
> "cut left example" << " " == " left example"
> because it should be equivalent to:
> "cut left example" << search("cut left example", " ");
>
> more interesting would be a form of split where only the first occurance (or
> the last) is split away, and both parts are returned.
>
> greetings, martin.
>
> --
> eKita - the online platform for your entire academic life
> --
> chief engineer eKita.co
> pike programmer pike.lysator.liu.se caudium.net societyserver.org
> BLUG secretary beijinglug.org
> foresight developer foresightlinux.org realss.com
> unix sysadmin
> Martin Bähr working in china http://societyserver.org/mbaehr/
>