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.
string to copy
A null-terminated copy of the input array.
auto s1 = "foo"; auto s2 = s1.xarraydup; s2[0] = 'b'; assert(s1 == "foo"); assert(s2 == "boo"); assert(*(s2.ptr + s2.length) == '\0'); string sEmpty; assert(sEmpty.xarraydup is null);
See Implementation
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.