Removing whitespace duplicates
via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Oct 22 12:19:45 PDT 2014
On Wednesday, 22 October 2014 at 19:00:36 UTC, Nordlöw wrote:
> On Tuesday, 21 October 2014 at 08:04:13 UTC, bearophile wrote:
>> If your text is ASCII, then there is std.ascii.whitespace that
>> can be given as argument to std.string.tr.
>>
>> Bye,
>> bearophile
>
> http://dlang.org/phobos/std_ascii.html#.whitespace
>
> is of string but
>
> std.string.tr needs [string] as argument.
>
> How does that work?
string a = "test \t \t test";
writeln(a.tr(std.ascii.whitespace,"_","s"));
More information about the Digitalmars-d-learn
mailing list