string to copy
A null-terminated copy of the input array.
1 auto s1 = "foo"; 2 auto s2 = s1.xarraydup; 3 s2[0] = 'b'; 4 assert(s1 == "foo"); 5 assert(s2 == "boo"); 6 assert(*(s2.ptr + s2.length) == '\0'); 7 string sEmpty; 8 assert(sEmpty.xarraydup is null);
Makes a null-terminated copy of the given string on newly allocated memory. The null-terminator won't be part of the returned string slice. It will be at position n where n is the length of the input string.