advibm:

I would like to have something like that:

char[] buf; // already filled array
char[] partOfBuf = betweenTwoStrings(buf, "START", "END");
partOfBuf[0] = 'a'; // THIS should also change the 'buf' variable
assert(buf[0] == 'a');

Thanks for your help

To do this you don't need to return a ref slice. A slice suffices. But D strings/wstrings/dstrings are made of immutable chars, so you can't modify them. So you need to work with char[] or dchar[] or wchar[].

Bye,
bearophile

Reply via email to