On Friday, 14 July 2017 at 20:52:54 UTC, Jonathan M Davis wrote:
And of course, this whole issue is incredibly confusing to
anyone
coming to D - especially those who aren't well-versed in
Unicode.
Right on. Thanks for your very clear summary (the whole thing,
not just the last line!). Much
On 07/15/2017 04:33 AM, Namal wrote:
Why does it have to be char[]?
auto bytes = line.representation.dup;
bytes.sort;
string result = bytes.assumeUTF;
works too.
That's a compiler bug. The code should not compile, because now you can
mutate `result`'s elements through `bytes`. But
On Friday, 14 July 2017 at 17:23:41 UTC, Steven Schveighoffer
wrote:
import std.string: representation, assumeUTF;
import std.algorithm: sort;
auto bytes = line.representation.dup;
bytes.sort;
auto result = bytes.assumeUTF; // result is now char[]
Why does it have to be char[]?
auto
On Friday, July 14, 2017 7:50:17 PM MDT Anton Fediushin via Digitalmars-d-
learn wrote:
> On Friday, 14 July 2017 at 17:23:41 UTC, Steven Schveighoffer
>
> wrote:
> > Don't do this, because it's not what you think. It's not
> > actually calling std.algorithm.sort, but the builtin array sort
> >
On 07/14/2017 09:50 PM, Anton Fediushin wrote:
But why? This should be true for `char[]`, isn't it?
-
if ((ss == SwapStrategy.unstable && (hasSwappableElements!Range ||
hasAssignableElements!Range) || ss != SwapStrategy.unstable &&
hasAssignableElements!Range) && isRandomAccessRange!Range
On 7/14/17 3:50 PM, Anton Fediushin wrote:
On Friday, 14 July 2017 at 17:23:41 UTC, Steven Schveighoffer wrote:
Don't do this, because it's not what you think. It's not actually
calling std.algorithm.sort, but the builtin array sort property. This
will be going away soon.
This sucks. I know,
On Friday, 14 July 2017 at 17:23:41 UTC, Steven Schveighoffer
wrote:
Don't do this, because it's not what you think. It's not
actually calling std.algorithm.sort, but the builtin array sort
property. This will be going away soon.
This sucks. I know, that `.sort` will be removed, but I thought
On 7/14/17 1:42 PM, Seb wrote:
On Friday, 14 July 2017 at 17:28:29 UTC, Namal wrote:
On Friday, 14 July 2017 at 16:43:42 UTC, Anton Fediushin wrote:
On Friday, 14 July 2017 at 15:56:49 UTC, Namal wrote:
Thx Steve! By sorting string I mean a function or series of
functions that sorts a string
On Friday, 14 July 2017 at 17:28:29 UTC, Namal wrote:
On Friday, 14 July 2017 at 16:43:42 UTC, Anton Fediushin wrote:
On Friday, 14 July 2017 at 15:56:49 UTC, Namal wrote:
Thx Steve! By sorting string I mean a function or series of
functions that sorts a string by ASCII code, "cabA"
On Friday, 14 July 2017 at 16:43:42 UTC, Anton Fediushin wrote:
On Friday, 14 July 2017 at 15:56:49 UTC, Namal wrote:
Thx Steve! By sorting string I mean a function or series of
functions that sorts a string by ASCII code, "cabA" to "Aabc"
for instance.
import std.algo
On 7/14/17 12:43 PM, Anton Fediushin wrote:
On Friday, 14 July 2017 at 15:56:49 UTC, Namal wrote:
Thx Steve! By sorting string I mean a function or series of functions
that sorts a string by ASCII code, "cabA" to "Aabc" for instance.
import std.algorithm : sort;
import
On Friday, 14 July 2017 at 15:56:49 UTC, Namal wrote:
Thx Steve! By sorting string I mean a function or series of
functions that sorts a string by ASCII code, "cabA" to "Aabc"
for instance.
import std.algorithm : sort;
import std.stdio : writeln;
"cabA".du
cii whitespace, you can
do it a bit more efficiently, but it's not easy.
About the string sorting, you'd have to be more specific.
-Steve
Thx Steve! By sorting string I mean a function or series of
functions that sorts a string by ASCII code, "cabA" to "Aabc" for
instance.
t a
bit more efficiently, but it's not easy.
About the string sorting, you'd have to be more specific.
-Steve
Is there a 'easy' way to sort a string in D like it is possible
in Python? Also how can I remove whitespace between characters if
I am reading a line from a file and safe it as a string?
string[] buffer;
foreach (line ; File("test.txt").byLine)
buffer ~= line.to!string;
15 matches
Mail list logo