On 03/03/2015 11:38 AM, Steven Schveighoffer wrote:

> Sure, but I think that for phobos to say you can't fill a large char[]
> with a repeat of small char[], but you can fill a large int[] with a
> repeat of small int[], is more of a problem than somehow fixing the
> underlying situation.
>
> Other algorithms treat char[] specially. fill should too.

std.string.representation works in this case.

import std.stdio;
import std.algorithm;
import std.string;

void main()
{
    char[] strArr = "http://www.hurriyet.com.tr/ekonomi".dup;
    auto domain = findSplitAfter(strArr.representation,
                                 "http://";)[1].until('/');
    fill(domain, 'a');
    writeln(strArr);
}

Prints

http://aaaaaaaaaaaaaaaaaaa/ekonomi

Ali

P.S. Grrr. Why can't I ever remember the name of that function! (representation, representation, representation, ...)

Reply via email to