On Tuesday, 2 July 2013 at 23:08:37 UTC, Artur Skawina wrote:
On 07/02/13 22:47, TommiT wrote:
Division operator for strings doesn't make any sense, and I
doubt there will ever be some other meaning for '/' that would
make more sense than "a directory separator" for strings in
the context of programming.
Umm,
$ /usr/bin/pike
Pike v7.8 release 537 running Hilfe v3.5 (Incremental Pike
Frontend)
> "/a/b//c" / "/";
(1) Result: ({ /* 5 elements */
"",
"a",
"b",
"",
"c"
})
That's the only sane use of the division operator on string
types;
anything else would be extremely confusing.
And this still does not mean that it would be a good idea in D.
Typing out "splitter()" is not /that/ hard.
artur
Perhaps an even more logical meaning for / operator for strings
would be to divide the string to N equal sized parts (plus a
potential remainder):
"abcdefg" / 3
result: ["ab", "cd", "ef", "g"]
But your "divide this string using this divider character" is
pretty logical too (once you know it).