Operate with void[]

Sergey httpal at gmail.com
Tue Jan 14 23:32:45 PST 2014


On Wednesday, 15 January 2014 at 05:21:26 UTC, Sergey wrote:
> On Wednesday, 15 January 2014 at 04:04:05 UTC, Adam D. Ruppe 
> wrote:
>> On Wednesday, 15 January 2014 at 03:53:18 UTC, Sergey wrote:
>>> 	str2[0] = replace(pert, [9], [9,9,10]); // ?????????	
>>
>> Try changing that line to this:
>>
>>        pert = replace(pert, cast(ubyte[]) [9], cast(ubyte[]) 
>> [9,9,10]);
>>
>> There's no str2 variable, so I assigned to pert instead. I 
>> casted the other arrays to ubyte[] because otherwise it throws 
>> all kinds of errors about ints instead of bytes (number 
>> literals are ints and the replace function is a bit picky)
>
> Sorry, str2 is my mistake.
> And I think the last question:
> when the number of bytes with the number 9 is not known how to 
> attach them?
>
>
> pert = replace(pert, cast(ubyte[]) [9], cast(ubyte[])[9] +
> ubyte[])[9] + ...n... + ubyte[])[10]);

again sorry....:)))
some_ubyte = some_ubyte ~ cast(ubyte[])[9]


More information about the Digitalmars-d mailing list