Thread overview
Null terminated character
Jun 23, 2022
vc
Jun 23, 2022
frame
Jun 23, 2022
frame
Jul 02, 2022
Bastiaan Veelo
June 23, 2022

I've try this '\0'*10 and didn't work, i want the results be \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00

June 23, 2022

On Thursday, 23 June 2022 at 16:16:26 UTC, vc wrote:

>

I've try this '\0'*10 and didn't work, i want the results be \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00

One way:

import std.range;

repeat("\0", 10).join("");
June 23, 2022

On Thursday, 23 June 2022 at 17:27:51 UTC, frame wrote:

>

On Thursday, 23 June 2022 at 16:16:26 UTC, vc wrote:

>

I've try this '\0'*10 and didn't work, i want the results be \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00

One way:

import std.range;

repeat("\0", 10).join("");

If you just need an array:

char[] n;
n.length = 10;
n[] = '\0';
July 02, 2022

On Thursday, 23 June 2022 at 16:16:26 UTC, vc wrote:

>

I've try this '\0'*10 and didn't work, i want the results be \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00

string nulls = '\0'.repeat(10).array;

— Bastiaan.